Date: Sun, 2 Apr 95 19:21 MDT From: mat AT ardi DOT com (Mat Hostetter) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Dynamic allocation question References: <01HOV5OOOLOM8ZEIJR AT cc DOT uab DOT es> <199504022219 DOT SAA08085 AT delorie DOT com> >>>>> "Mat" == Mat Hostetter 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