davec-b at rogers.com
Tue Jul 10 01:22:29 GMT 2007
On Mon, Jul 09, 2007 at 12:00:54PM +1000, Tim Potter wrote:
>>How do we ensure that? Any idiom that requires the programmer to
>>remember to do something is a bit broken as it's guaranteed that someone
>>will forget and introduce a memory leak.
Jeremy Allison wrote:
> Yeah well that's call a C++ destructor, as well you know :-).
> In C we do the best we can....
Well, if we can't easily catch it in the development process, do it in
in the regression-test process. Make sure that finding the leak is
b) indicative of the location of the error.
The latter should be easy, iff the rule is to free in the same function
as the create: just make sure we can find where we created it, whenever
we discover an orphan. The saved location need not be in the non-test
code, of course... A Smarter Colleague[tm] (Hi, Fred!) once called
that a "retrospective assertion" (:-))
David Collier-Brown, | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb at spamcop.net | -- Mark Twain
More information about the samba-technical