Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: how do you know 'free' freed?
Message-ID: <1989Oct13.165553.29474@utzoo.uucp>
Organization: U of Toronto Zoology
References: <5521@hacgate.UUCP>
Date: Fri, 13 Oct 89 16:55:53 GMT

In article <5521@hacgate.UUCP> howard@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@zoo.toronto.edu
