Mail Archives: djgpp/1993/05/07/08:58:20
No it's not. Malloc needs a few extra bytes to store it's private information
(like the size of the allocated block).
Therefore, if you allocate 1000 bytes, you're really using 1004.
If you allocate 500 bytes, you're using 504.
Since 2*504 = 1008 > 1004, you can't expect malloc to recycle the
memory. If you were to allocate two chunks of size 400, for example,
then it should be able to recycle the memory.
Greg Kochanski gpk AT physics DOT att DOT com
AT&T Physics Research -- Physics for Fun and Profit
- Raw text -