malloc_g debug library

Hi all,

I am using malloc_g debug library to trace out a memory leak problem. It gives following information:

MALLOC Warning from malloc() (called from instruction preceding 0x07FBE508):
Malloc region doesn’t have a valid CRC in header
This error is probably associated with the following allocation:

A call to malloc for 37 bytes in an unknown file near 7FBE4E8.
This was the 2738th call to malloc.

It is not giving the exact file name and line number where the problem occurs. Is there any other way
to get those information in the warning messages.


Not that I know of.


In a roundabout way you can get the information you want. Not from mallocg giving you a line number and filename but by looking at a map file.

In other words, on your CFLAGS line just specify the option to create a map file (if your using qcc, the -M option is the one you want) and relink your app. Then run your app again and wait for that error to be generated.

Then look up the address (we’ll assume its 7FBE4E8 again) in the map file. It will show you the function call and file name (but not line number). Note you will not find the exact address in the map file but just get the closest thing before that address (ie search for 7FBE then when you find it, go down from 7FBE000 till you find the closest function that has an address before 7FBE4E8 and that’s the one that the malloc occurred in).