Bug 81079

Summary: Provide a macro to show new leaks
Product: [Developer tools] valgrind Reporter: Dominik Stadler <dominik.stadler>
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: wishlist CC: philippe.waroquiers
Priority: NOR    
Version: 2.1.1   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Dominik Stadler 2004-05-07 10:42:26 UTC
Version:           2.1.1 (using KDE KDE 3.2.0DevelKDE 1.2)
Installed from:    Compiled From SourcesCompiled From SourcesCompiled From Sources
Compiler:          gcc-2.96 
OS:          Linux

Memcheck already provides a macro VALGRIND_DO_LEAK_CHECK that I can add to my application to print out all the memory blocks that are currently allocated when execution reaches the point where the macro is used. 

For some hard-to-find memory-leaks I would like to have a macro like VALGRIND_SHOW_NEW_LEAKS that only shows memory leaks that it didn't show before. 

That means the memcheck-skin would probably need to add a flag to each memory block that indicates if the block was already shown and then only show new memory blocks when the new macro is encountered.

This would allow to check applications that keep running in a loop (e.g. wait for the next message, process it). I would be able to add the macro at the end of the loop and thus see in each iteration of the loop which memory was additionally allocated but not freed.
Comment 1 Nicholas Nethercote 2004-05-07 11:33:46 UTC
Reclassified as "wishlist".
Comment 2 Philipp Berndt 2004-06-09 12:32:43 UTC
How about a client request macro to clear the current leak list?

That should do what we need and should be a little easier to implement.
Comment 3 Dominik Stadler 2004-06-12 13:21:25 UTC
That would be fine for me and should indeed be much easier to implement.
Comment 4 Philipp Berndt 2004-09-30 18:22:04 UTC
Could someone please rename this wish to "provide macro to clear leak list" ?

When will this feature be implemented?
Comment 5 Jeremy Fitzhardinge 2005-03-02 17:58:53 UTC
There isn't actually a "leak list" to clear.  You'd implement this feature by pinning leaked blocks during a leak check, so that they don't appear leaked in the next leak check.
Comment 6 Philippe Waroquiers 2012-05-26 14:07:38 UTC
available in 3.7.0 e.g.
VALGRIND_DO_ADDED_LEAK_CHECK in memcheck.h