#include <crtdbg.h>
void
DetectMemLeaks()
{
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF);
_CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR);
}
Un appel au debut du prog, les memory leaks (s'ils existent) sont indiqués dans la fenetre 'Sortie' de VC++ (Code donc QUE pour VC++).
+2(p - n)