|
From: Stuart W. <de...@ra...> - 2009-08-16 23:30:39
|
Hi Nicholas, Thanks for your patience. I'm working on an embedded application that only restarts when it is power cycled. It has to do a lot with limited memory and uses dozens of memory arenas with different lifetimes. Arenas are set up and torn down hundreds of times during the lifetime of the application. As such, it only makes sense to report leaks as each arena is torn down. Just like it makes sense to report malloc leaks when its lifetime ends. > > VALGRIND_DO_LEAK_CHECK and --leak-check both look for leaks in all > > current memory pools. I don't know why you think this is not the > > case. memcheck/tests/mempool.c makes it clear -- for example, x1 and > > x2 are leaked. > > > I understand and am not saying to the contrary. As you say VALGRIND_DO_LEAK_CHECK reports leaks for _all_ pools. In my case the leak report is only helpful if it can target leaks from a specific mempool. > > But, as you've been told, if you destroy a mempool all the chunks > > within it are freed, and so there can be no leaks from that mempool. > > That's why x3 and x4 aren't reported as leaked, because they've been > > freed. > > > Sure there are no leaks when it is destroyed, but if I have a 1MB arena that makes 2MB of allocations over its lifetime, leaks during the arena's lifetime become a problem. I have no problem with the test case. I made the mistake of using the test case to try and and explain my point....and failed miserably. Unfortunately the mempool documentation doesn't say how leak checking should work for mempools, but it does say it doesn't make any assumptions about how custom allocators should work. > > I think you should read the documentation again and try writing some > > small test programs to improve your understanding. > > > I'll go back and read through the documentation. Thanks for the suggestion. Cheers, Stu > > NIck > > > > ------------------------------------------------------------------------------ > > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > > trial. Simplify your report design, integration and deployment - and focus on > > what you do best, core application coding. Discover what's new with > > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > _______________________________________________ > > Valgrind-developers mailing list > > Val...@li... > > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > > > > > |