Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Leak Sanitizer - how to suppress leaks



On Fri, Sep 13, 2019 at 07:03:40PM +0700, Robert Elz wrote:
 > It isn't so much that I think we need to save the cost of doing
 > the free() (though for ps it turns out to be harder than you'd expect
 > to actually get it right) but whether it is worth anyone time and
 > effort to actually work out what is needed (if anything at all).  Since
 > ps simply exits, we know there is no real leak, only the illusion of
 > one very briefly.

Keep in mind, though, that one of the roles of NetBSD has always been
to serve as a reference implementation.

There have been OSes in the past where memory not freed yet at process
exit is _not_ freed by the system, and there might be again, and in
cases where it isn't expensive to do so it seems that we may as well
tidy up properly so that the code will run acceptably on such OSes.

In cases where it _is_ expensive, or at least where it's expensive to
figure out, the same argument applies as against garbage collection:
if you aren't sure what the lifetime of that object is, and the
program isn't structured in a way that allows being reasomably sure it
is disposed of exactly once, how can you have confidence in any other
correctness properties?

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index