MemoryAlloc.cpp

Go to the documentation of this file.
00001 /*
00002 *       This file contains override operators NEW,DELETE for memory allocation.
00003 *
00004 *       Author:
00005 *                       Tomas Mrkvicka
00006 *                       xmrkvi03@stud.fit.vutbr.cz
00007 *
00008 */
00009 
00010 #include "MemoryAlloc.h"
00011 
00012 int TMemoryAllocStats::m_alloc_normal   = 0;
00013 int TMemoryAllocStats::m_alloc_array    = 0;
00014 
00015 /** Pomoci teto podminky definujeme zda budou pretizene peratory zapnute nebo ne.
00016 */
00017 #if 1           // pouzivame pretizene globalni operatory
00018 
00019 /** Global operator new.
00020 *
00021 *       \param size             [in] required memory size in bytes
00022 */
00023 inline void * operator new(size_t size)
00024 {
00025         TMemoryAllocStats::New_Normal();
00026 
00027         return malloc( size ) ;
00028 }
00029 
00030 /** Global operator new[].
00031 *
00032 *       \param size             [in] required memory size in bytes
00033 */
00034 inline void * operator new[](size_t size)
00035 {
00036         TMemoryAllocStats::New_Array();
00037 
00038         return malloc( size );
00039 }
00040 
00041 /** Global operator delete.
00042 *
00043 *       \param ptr      [in] pointer to memory to release
00044 */
00045 inline void operator delete(void * ptr)
00046 {
00047         TMemoryAllocStats::Delete_Normal();
00048 
00049         return free( ptr );
00050 }
00051 
00052 /** Global operator delete[].
00053 *
00054 *       \param ptr      [in] pointer to memory to release
00055 */
00056 inline void operator delete[](void * ptr)
00057 {
00058         TMemoryAllocStats::Delete_Array();
00059 
00060         return free( ptr );
00061 }
00062 
00063 #endif

Generated on Sat Nov 17 16:23:26 2007 for Image Processing Pipeline by  doxygen 1.4.6-NO