Mail Archives: djgpp/1995/04/02/22:11:04
>>>>> "Mat" == Mat Hostetter <mat AT ardi DOT com> writes:
Mat> Some people write their own my_malloc/my_realloc/my_free that
Mat> keep track of the block size in a portable way and use these
Mat> routines consistently. What you do is allocate four bytes
Mat> more than you need with `malloc', store the size at the base
Mat> of the allocated memory, and then return the allocated
Mat> address plus four bytes.
I should point out that this can do Bad Things on systems where
malloc's return value needs to be aligned % 8 bytes (for doubles or 64
bit longs, etc.).
-Mat
- Raw text -