I have just resolved a memory leak in my application and now I want to write a unit test to ensure that this does not happen again.
I'm look for a way to detect the memory usage of the current application (working set), before and after some functions.
For example:
long mem_used= GetMemUsed();
/* Do some work */
/* clean up */
if( mem_used != GetMemUsed() ) {
Error( "Memory leek" );
}
I have found plenty of ways to detect the memory usage across the entire system but none for just the current application.
Suggestions, links, code snippets?