how does free() know how much to free?

Steve Summit scs at adam.mit.edu
Tue Feb 26 15:50:59 AEST 1991


In article <1991Feb26.024207.26167 at wpi.WPI.EDU> fenn at wpi.WPI.EDU (Brian Fennell) writes:
>how does free know how much to free?

*Four!*  Our four weapons are...

Ahem. YA FAQ list teaser:

55.  How does free() know how many bytes to free?

A:   The malloc/free package remembers the size of each block it
     allocates and returns, so it is not necessary to remind it of the
     size when freeing.

Security on adam is not tight; clearly some underground hacker's
organization, for inscrutable purposes of its own, has broken in
and stolen a copy of next month's greatly-expanded FAQ list, and
is now trickling out its new questions, from random accounts
around the country, just to torment me...

                                            Steve Summit
                                            scs at adam.mit.edu

Maybe I should just post the darn thing a week early...



More information about the Comp.lang.c mailing list