How can I get valgrind to tell me the address of each unpinned block of memory?
Valgrind tells me function xxx, memory allocated that has not been freed. Good. However, this proved to be more difficult than usual.
For this purpose, I have created many:
#ifdef DEBUG
fprintf(stderr, "something happening:%lx\n", (unsigned long)ptr);
#endif
So I just need to match these ptr addresses that are mapped to the unrun memory addresses.
How can I get valgrind to tell me the address of each unpinned block of memory?
I don't believe Memcheck leak check supports printable addresses, unfortunately. This is because he wants to combine several unallocated blocks into one "loss report" if they are similar.
If you don't mind popping up in Memcheck, this functionality must be removed in order to be added to memcheck / mc_leakcheck.c in the Valgrind source. I will look at it when I get home and post a more detailed location.
source to share
Thanks to Falaina for the location of the code.
For valgrind-3.2.3, the place that worked for me was in memcheck / mc_leakcheck.c, lc_scan_memory_WRK function.
Added this after lc_markstack_push_WRK (addr, clique); on line # 472
if (clique! = -1) {VG_ (printf) ("click% d:% p \ n", click, ptr); }
source to share