[patches] avoid unless exit()

Thomas Cataldo tcataldo at gmail.com
Mon Mar 29 21:48:28 EDT 2010


On Tue, Mar 30, 2010 at 12:04 AM, Greg A. Woods <woods-cyrus at weird.com>wrote:
>
> A memory leak is memory consumption by a computer program where the
> program is unable to release memory it has acquired.
>
> On a code path that definitively always ends with exit(2), all memory
> is, by definition, released.  Therefore there is no "leak" possible on
> any sure code path to exit().
>
> Relying on memory profilers which primarily try to determine memory
> leaks by reporting on unreleased memory left at the time of the exit()
> call is a fallacy sure to waste a lot of maintenance and coding time.
>
> The only time memory leaks are actually important is when the program
> continues to run!  Ideally the memory profiler must be triggered to
> report unreleased memory at the time the program restarts its main loop
> of execution in order to generate useful reports of unreleased memory.



Relying on exit freeing up memory is pretty lazy as it prevents switching to
threads.
Valgrind reports memory hold at exit time as a leak and I think it's a good
thing.

I'm only a java programmer using cyrus for its webmail need by I think that
fork/leak/leak/exit is a bad programming model.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/info-cyrus/attachments/20100330/b163213e/attachment.html 


More information about the Info-cyrus mailing list