At Sun, 28 Mar 2010 22:19:16 +0200, Gabor Gombas <gomb...@digikabel.hu> wrote: Subject: Re: [patches] avoid unless exit() > > On Fri, Mar 26, 2010 at 12:01:01PM -0400, Greg A. Woods wrote: > > > on "return" paths, perhaps, but not exit() paths -- there is no leak on > > exit() :-) > > The leak of course happens much before exit(). But memory profilers > report unfreed memory after the process exits, and there is definite > difference between having to verify 10 or 10000 of those reports.
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. -- Greg A. Woods +1 416 218-0098 VE3TCP RoboHack <wo...@robohack.ca> Planix, Inc. <wo...@planix.com> Secrets of the Weird <wo...@weird.com> ---- Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html