Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ippMemoryLeakDetector.h

Go to the documentation of this file.
00001 // 
00002 // DISCLAIMER: 
00003 //  This software was produced by the National Institute of Standards 
00004 //  and Technology (NIST), an agency of the U.S. government, and by statute is 
00005 //  not subject to copyright in the United States.  Recipients of this 
00006 //  software assume all responsibility associated with its operation,
00007 //  modification,maintenance, and subsequent redistribution. 
00008 //
00009 //  See NIST Administration Manual 4.09.07 b and Appendix I. 
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(&current);
00028     _CrtMemState diff;
00029     if ( _CrtMemDifference( &diff, &m_memstate, &current ) )  {
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 };

Generated on Wed Nov 8 00:20:07 2006 for IPPDME by  doxygen 1.4.1