why is free() a void?

Niels J|rgen Kruse njk at diku.dk
Fri Oct 26 23:46:49 AEST 1990


rh at smds.UUCP (Richard Harter) writes:

>   It is easier (and faster) to put the allocation control information
>in memory adjacent to the allocated block in allocators which use free
>lists (bit mapped buddy-system allocators are a different matter.)

>IMNSHO this is not nice.  It is a source of mystery bugs.  An array
>overwrite in allocated memory can wipe out control information; the
>consequence doesn't hit you until much later.

If thre is no adjacent control information, the array overwrite
will just scribble over some of the data you have in the next
block.  This is not a source of mystery bugs?  Your program may
not dump core, but the output will be slightly corrupted.  Ugh.
-- 
Niels J|rgen Kruse 	DIKU Graduate 	njk at diku.dk



More information about the Comp.lang.c mailing list