On Apr 10, 2007, at 3:50 PM, Travis Rose wrote:
Hello all,
Hi... this may not be the right list for this type of question. Are you working in kernel?
I've noticed something strange with malloc and free on Mac OS X.
I have a recursive function that does compression.
In this function, as the data are compressed, I wish to release some previously allocated memory;
For example,
int* decompress = myTableStart[block_number]; //get the pointer to the block
... do compression ...
free(decompress); //free the block <-- this is not having any effect!!!
For some reason, the memory is not freed immediately, so it behaves like a leak ... and the program eventually crashes.
Any ideas on how to fix this?
Can you explain how the memory is allocated? (Ideally with code that shows the issue)
Do you see any messages in the console log about malloc failures?
Which version of Mac OS X you testing this on?
How deep is your recursion? Are you sure you aren't blowing out the threads stack space?
P.S. The same code works on linux
Which may not be a helpful bit of information.