I just resolved a memory leak in my application, and now I want to write unit test so that this does not happen again.
I am looking for a way to determine the memory usage of the current application (working set) before and after some functions.
For instance:
long mem_used= GetMemUsed();
if( mem_used != GetMemUsed() ) {
Error( "Memory leek" );
}
I found many ways to detect memory usage throughout the system, but none of them are used only for the current application.
Suggestions, links, code snippets?
source
share