how do you know 'free' freed?

Henry Spencer henry at utzoo.uucp
Sat Oct 14 02:55:53 AEST 1989


In article <5521 at hacgate.UUCP> howard at aic.dpl.scg.hac.com (Mike Howard (213)317-5690) writes:
>I've malloc'd a tree structure, and then free'd it, node by node.
>Of course, freeing it just marks it as free, and I can still walk
>through the tree after freeing it.  I'd like to confirm that it is
>in fact free.

You can sort-of do this by having your free-ing function clear the nodes
just before it frees them.  This is also a *wonderful* debugging aid,
because freed nodes never get mistaken for normal ones.
-- 
A bit of tolerance is worth a  |     Henry Spencer at U of Toronto Zoology
megabyte of flaming.           | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list