|
From: Nicholas N. <n.n...@gm...> - 2009-08-12 22:27:10
|
On Wed, Aug 12, 2009 at 10:51 PM, Stuart Warren<de...@ra...> wrote: > Hi, > > I've been using memcheck mempools with a custom memory allocator and > noticed that mempool leaks aren't detected if the mempool has been > destroyed. > > [...] > > The memcheck code lines up with this behavior - once a mempool has been > destroyed, all references to it's allocations are lost. It doesn't seem > possible to then report leaks when the executable finishes. I'm not all that familiar with the mempool code, but my understanding is that when you destroy a pool, it implicitly frees all the blocks that have been allocated out of the pool as well. The manual (http://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.mempools) says: "VALGRIND_DESTROY_MEMPOOL(pool): This request tells Memcheck that a pool is being torn down. Memcheck then removes all records of chunks associated with the pool, as well as its record of the pool's existence. While destroying its records of a mempool, Memcheck resets the redzones of any live chunks in the pool to NOACCESS." So the test is behaving, both before and after your change, as I'd expect. N |