0

I met a BAMR (Beyond All My Recognition) error, I have a small single-thread application, just create an openGL context and draw something for test purpose. It runs well both in Windows7 and Ubuntu64. These days I am porting it to Linux armv7 (arm-linux-gnuabihf), the host machine is ubuntu x64, gcc/g++ version is 4.6(arm-linux-gnuabihf), before this app I've been compiled several small apps and running well. Every time I run this application will print below error:
/////////////////////
Step 1 Inconsistency detected by ld.so: dl-minimal.c: 136: realloc: Assertion `ptr == alloc_last_block' failed!
/////////////////////
Here is my code, it looks like each time the error happens before an if(..) clause? How strange it is! Anyone have any idea? Thanks a lot!

HRESULT TestWorkloadBase::CreateGLWindow()
{
    printf("Step 1");
    if (m_bPrompt) //m_bPrompt has been initialized
    {
        printf("Step 2");
        int ProcessId = GetProcessID();
        printf("Process Id is %d Starting... Please press a key to continue.\n", ProcessId);
        printf("Step 3");
        std::cin.ignore();
    }
    printf("Step 4");
    #if !defined(_WIN32)
    if (getenv("DISPLAY") == NULL)
    {
        setenv("DISPLAY", ":0.0", 0);
    }
    ...
}

The "Step 1" will be printed each time.

  • I suspect that the code you have listed is irrelevant to the bug, but I could be wrong. It is the sort of error I would expect to see raised if you'd been using invalid iterators, or other sorts of memory-related badness. Does "Step 1" ever get printed? If not, I'd look at the code which calls `CreateGLWindow`. – Rook May 13 '14 at 07:31
  • The "Step 1" will printed each time. I listed the all code here: – user3631204 May 13 '14 at 07:38
  • Surely `...` is not your ACTUAL code, since that won't compile... – Mats Petersson May 13 '14 at 07:43
  • You did not include the code which allocates the memory pointed by `pWorkload` (function `CreateTestWorkload` I presume). This is a vital piece of information missing here, let alone the member functions of class `TestWorkloadBase`, which might be corrupting the allocated memory!!! – barak manos May 13 '14 at 07:45
  • You are correct, but it's after where error happened. The following code is a little bit long, is it necessary – user3631204 May 13 '14 at 07:47
  • I posted all the code in call graph. – user3631204 May 13 '14 at 08:14
  • Might be the same problem: https://stackoverflow.com/questions/59956996/problem-loading-a-library-with-ffi-in-php-7-4 -- one (or more) of the shared objects has dependency-order problem – Lorinczy Zsigmond Feb 01 '20 at 05:26

0 Answers0