get size of malloc'd object

David desJardins desj at brahms.BERKELEY.EDU
Thu Jun 26 11:36:59 AEST 1986


In article <9894 at ucsfcgl.UUCP> arnold at ucsfcgl.UUCP (Ken Arnold) writes:
>So put the int at the end of the space, after increasing the size
>to be allocated by sizeof (int) + enough space to align the int
>on a byte which is a multiple of sizeof (int).  Then return the
>original malloc()ed pointer.

   This is the silliest thing I've seen yet.  If you have a pointer to the
beginning of a region, and store the size of the region at the end of the
region, how are you ever going to be able to recover this information??

   -- David desJardins



More information about the Comp.unix mailing list