|
From: Nicholas N. <nj...@ca...> - 2004-01-17 13:32:10
|
On Tue, 13 Jan 2004, Jason Wood wrote: > I am trying to track down a memory leak in an application. The memory leak is > proving difficult to track down - valgrind's memleak check does not pick it > up, which suggests to me that the memory is being cleaned up at exit, but is > not being managed correctly while the app is running. > > Does anyone know of a way to take a memory "snapshot" - something like a list > of all memory currently allocated, grouped by the file line number of where > it was allocated, and sorted by the amount of memory that is allocated. I > feel that such a thing would let me solve this issue very quickly :-) You could also try Massif, a Valgrind tool that does heap profiling -- it gives you a graph, and an accompanying text or HTML file with lots of info showing which call-stacks are responsible for most of the memory usage. It can be useful for finding memory leaks like this. See www.cl.cam.ac.uk/~njn25/valgrind.html; you'll have to download and install the whole Valgrind with Massif in it, but we're considering putting Massif into the main distro. Failing that, mpatrol (www.cbmamiga.demon.co.uk/mpatrol/) might be able to give you the snapshot you want. HTH N |