What's the use of FEATURE_CLEANUP ?

Rob Landley rob at landley.net
Tue Dec 20 16:52:21 UTC 2005


On Tuesday 20 December 2005 10:02, Larry Doolittle wrote:
> Rob -
>
> On Mon, Dec 19, 2005 at 05:56:19PM -0600, Rob Landley wrote:
> > On Monday 19 December 2005 12:36, Larry Doolittle wrote:
> > > I believe the rationale for FEATURE_CLEANUP is to facilitate
> > > memory-leak checkups with e.g., dmalloc.  It flags memory
> > > locations that are _supposed_ to be left dangling at exit,
> > > so you can more easily find those that are _accidentally_
> > > left dangling at exit.
> >
> > I've always been a little unclear on the difference, myself.  Either
> > we're relying on exit() to clean up everything, or we're not.  What's the
> > middle ground for?
>
> If you malloc a buffer once, use it, and rely on exit() to clean
> up after yourself, that's a design decision.

And generally a good one for our purposes.

> If you malloc a buffer once for every directory entry in a tree
> walk, and never free any of them (or forget to clean up an
> occasional one because it has an odd number of characters and
> is lemon flavored), that's a bug.

And those free() calls aren't really optional.

> By flagging the first case to valgrind/dmalloc, it's easier to
> find the second case.

So FEATURE_CLEANUP should really be DEBUG_CLEANUP, then?

>         - Larry

Rob
-- 
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.



More information about the busybox mailing list