00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "ippUTest.h"
00011 #include <crtdbg.h>
00012 class ippMemoryLeakDetector
00013 {
00014 _CrtMemState m_memstate;
00015 public:
00016 ippMemoryLeakDetector()
00017 {
00018 #ifdef _DEBUG
00019 _CrtMemCheckpoint(&m_memstate);
00020 #endif
00021 }
00022 ~ippMemoryLeakDetector()
00023 {
00024 #ifdef _DEBUG
00025 _CrtCheckMemory();
00026 _CrtMemState current;
00027 _CrtMemCheckpoint(¤t);
00028 _CrtMemState diff;
00029 if ( _CrtMemDifference( &diff, &m_memstate, ¤t ) ) {
00030 _CrtMemDumpStatistics( &diff );
00031 }
00032 _CrtMemDumpAllObjectsSince(&m_memstate);
00033 IPP_UTEST_ASSERT_EQUALS((int)(diff.lCounts[_NORMAL_BLOCK]+diff.lCounts[_CLIENT_BLOCK]),0);
00034 if ((int)(diff.lCounts[_NORMAL_BLOCK]+diff.lCounts[_CLIENT_BLOCK])!=0 ){
00035 _CrtMemDumpAllObjectsSince(&m_memstate);
00036 }
00037 #endif
00038 }
00039
00040 };