D:/Zythum/DinoKod/Common/Memory.cpp

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : Memory.cpp
00006 //      Author                  : Sebastien LEIX        sebastien.leix@wanadoo.fr
00007 //      Date                    : 
00008 //      Modification    :
00009 //
00010 //---------------------------------------------------------------------------------------------
00011 //#include <windows.h>
00012 //#include <crtdbg.h>
00013 #include "Common/Memory.h"
00014 
00015 #if _DEBUG_MEM
00016 
00017 int             g_SizeAllocated = 0;
00018 
00019 //---------------------------------------------------------------------------------------------------------------------
00020 void* operator new( unsigned int Size )
00021 {
00022         g_SizeAllocated += Size;
00023 
00024         char    pMsg[1024];
00025         wsprintf( pMsg, "NEW : Memory allocated : %i\n", g_SizeAllocated );
00026         OutputDebugString( pMsg );
00027         
00028         return _malloc_dbg( Size, _CLIENT_BLOCK, __FILE__, __LINE__ );
00029 }
00030 
00031 //---------------------------------------------------------------------------------------------------------------------
00032 void operator delete( void* pPointer )
00033 {
00034         if( !pPointer )
00035                 return;
00036 
00037         g_SizeAllocated -= _msize_dbg( pPointer, _CLIENT_BLOCK );
00038 
00039         char    pMsg[1024];
00040         wsprintf( pMsg, "DELETE : Memory allocated : %i\n", g_SizeAllocated );
00041         OutputDebugString( pMsg );
00042 
00043         _free_dbg( pPointer, _CLIENT_BLOCK );
00044 }
00045 /*
00046 //---------------------------------------------------------------------------------------------------------------------
00047 void* malloc( unsigned int Size )
00048 {
00049         return operator new( Size );
00050 }
00051 
00052 //---------------------------------------------------------------------------------------------------------------------
00053 void free( void* pPointer )
00054 {
00055         delete pPointer;
00056 }
00057 */
00058 #endif _DEBUG_MEM

Generated on Sun Mar 25 20:02:11 2007 for Zythum Project by  doxygen 1.5.1-p1