why is free() a void?

Doug Gwyn gwyn at smoke.brl.mil
Wed Nov 7 19:36:58 AEST 1990


In article <212 at smds.UUCP> rh at smds.UUCP (Richard Harter) writes:
>The specs more or less explicitly provide that the users of malloc/free
>have all of the responsibility for using them without error.  The
>system is not obliged to do error checking.  It is at liberty to do
>something indeterminately awful if the programmer makes an error.
>All of this in one of the most primitive and least structured aspects
>of C.  Grumble, grumble, grumble.

If you really want thorough arena checking, you have to take a significant
performance hit.  Since it can be implemented outside the standard library,
that's a logical place for it.  People whose code doesn't have bugs would
be annoyed if all that unnecessary arena checking were forced upon them.

You can get a very nice (if I do say so myself) memory-allocation "wrapper"
that we call the "Mm package" free from the BRL MUVES project.  While Mm is
part of a larger system and may be tricky to configure outside the intended
compilation environment, it was designed to be useful in other projects and
has been used in them.  The additional overhead can be turned on to any
extent that you feel necessary.  It can even generate movie scripts for the
"anim" system.



More information about the Comp.lang.c mailing list