CompuServe Messages

Using malloc && realloc

    21-Jul-93 15:54:43
Sb: Using malloc && realloc
Fm: Jim Kingsepp 75010,624
To: All
I've been having problems using the standard C calls to malloc() and realloc() in my C code for the Mac. When I call either of these functions I get 15024 bytes of memory allocated for my pointer. However, when I call free() to deallocate the memory (in the case of calls to realloc() only) the 15024 block is not freed. The next time I call either of these functions, I get a new 15024 block and the old block is never deallocated. I run out of memory rather quickly. If I use NewPtr() and DisposPtr() everything is fine. However, I am writing code that will be ported so I can't use the Mac memory calls to NewPtr() and DisposPtr(). I had to settle for an #ifdef based on environment definitions in a header file to determine which call I am able to make. Is anyone else having these problems? Is there something I'm missing? Jim Kingsepp Moody's Investors Service