Bug 81079 - Provide a macro to show new leaks
Summary: Provide a macro to show new leaks
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 2.1.1
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-07 10:42 UTC by Dominik Stadler
Modified: 2012-05-26 14:07 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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