You can use the debug functionality right into dev studio to perform leak checking - as long as your unit tests' run using the debug c-runtime.
A simple example would look something like this:
#include <crtdbg.h>
struct CrtCheckMemory
{
_CrtMemState state1;
_CrtMemState state2;
_crtMemState state3;
CrtCheckMemory()
{
_CrtMemCheckpoint(&state1);
}
~CrtCheckMemory()
{
_CrtMemCheckpoint(&state2);
// using google test you can just do this.
EXPECT_EQ(0,_CrtMemDifference( &state3, &state1, &state2));
// else just do this to dump the leaked blocks to stdout.
if( _CrtMemDifference( &state3, &state1, &state2) )
_CrtMemDumpStatistics( &state3 );
}
};
And to use it in a unit test:
UNIT_TEST(blah)
{
CheckCrtMemory check;
// TODO: add the unit test here
}
Some unit test frameworks make their own allocations - Googles for example allocates blocks when a unit test fails, so the any test block that has a fail for any other reason always also has a false positive "leak".