What's the use of FEATURE_CLEANUP ?

Larry Doolittle ldoolitt at recycle.lbl.gov
Tue Dec 20 16:02:30 UTC 2005


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.

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.

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

        - Larry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.busybox.net/pipermail/busybox/attachments/20051220/7b908dcd/attachment-0002.pgp 


More information about the busybox mailing list