|
From: Darryl M. <dar...@ne...> - 2008-10-25 00:13:16
|
Is it possible to make valgrind dump out the locations of the "Still Reachable" pointers to still allocated memory at program exit ? From this I want to lookup any known symbols (global or file local from the debug data) to provide a name for that location. If that doesn't exist (maybe the pointer is inside another allocated block), then dump a reachability graph of the memory block the pointer was found inside, and its parent, and its parent, etc... with the possibility of the outermost allocation. Maybe there is a wrapper / UI tool for valgrind that can provide this ? TIA Darryl |
|
From: John S. <joh...@gm...> - 2008-10-25 00:43:46
|
On Fri, Oct 24, 2008 at 4:58 PM, Darryl Miles < dar...@ne...> wrote: > > Is it possible to make valgrind dump out the locations of the "Still > Reachable" pointers to still allocated memory at program exit ? > > Add --show-reachable=yes to your command line options. > > From this I want to lookup any known symbols (global or file local from > the debug data) to provide a name for that location. > > If that doesn't exist (maybe the pointer is inside another allocated > block), then dump a reachability graph of the memory block the pointer > was found inside, and its parent, and its parent, etc... with the > possibility of the outermost allocation. > > > Maybe there is a wrapper / UI tool for valgrind that can provide this ? > > TIA > > Darryl > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |
|
From: Darryl M. <dar...@ne...> - 2008-10-25 02:15:34
|
John Shilkaitis wrote: > On Fri, Oct 24, 2008 at 4:58 PM, Darryl Miles > Is it possible to make valgrind dump out the locations of the "Still > Reachable" pointers to still allocated memory at program exit ? > > > Add --show-reachable=yes to your command line options. Sorry I was not clear. I am aware of the --show-reachable=yes. This shows me that there are reachable allocated blocks: * It shows me the backtrace of the call to the allocator. * It provides me the size of the allocation. * It provides me with the number of similar still reachable allocations (based on similar backtrace and allocations size - i guess) But it doesn't show me: * Where in memory they are reachable from (the address of one of more pointers, pointing to/into the block). This is the magic thing that makes them "Still Reachable" as opposed to "Lost". * The address of each block itself (this data appears collapsed by the reporting of the number of similar allocations). It is my understanding that at program exit valgrind computes all the blocks of memory still allocated. Then it combs the memory for aligned locations that have a pointer to the start of (or into) the block. If it finds one or more pointers it marks the blocks as "Still Reachable". So there are 2 pieces of useful information missing from the outputed data: * The memory location of each pointer that points to a block. * The address of each block. (Which would allow me to think of the of adding my own debugging for that specific invocation return that address). Darryl |
|
From: tom f. <tf...@al...> - 2008-10-25 05:00:40
|
Darryl Miles <dar...@ne...> writes: > John Shilkaitis wrote: > > On Fri, Oct 24, 2008 at 4:58 PM, Darryl Miles > > Is it possible to make valgrind dump out the locations of the "Still > > Reachable" pointers to still allocated memory at program exit ? > > > > Add --show-reachable=yes to your command line options. > > Sorry I was not clear. I am aware of the --show-reachable=yes. [snip] > But it doesn't show me: > * Where in memory they are reachable from (the address of one of more > pointers, pointing to/into the block). This is the magic thing that > makes them "Still Reachable" as opposed to "Lost". > * The address of each block itself (this data appears collapsed by the > reporting of the number of similar allocations). Have you tried show reachable with --leak-resolution=high? The default is `low'. Supposedly on the trunk there is an option for providing better leak error information which might be more helpful. ``--track-origins''. I'm just regurgitating information, haven't tried it myself, YMMV, etc. etc. -tom |