00001 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 00002 /* _______ ______ ______ __ */ 00003 /* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ / ____(_)___ / ___ /) / ____/___ ____/ /__ */ 00004 /* [fsMemMgr] / /_ / / __ \\__ \|/ / / / __ \/ __ / _ \ */ 00005 /* rev. 24 / __/ / / /_/ /__/ / / /___/ /_/ / /_/ / __/ */ 00006 /* 20th Jan 2007 /_/ /_/ ,___/____/ \____/\____/\__,_/\___/ */ 00007 /* [x] stable /_/ (c) 2005-7 Filip STOKLAS (FipS) */ 00008 /* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ http://HOLE.4FipS.com/fips_code.php */ 00009 /* */ 00010 /* This code is free for personal and commercial use. You may redistribute */ 00011 /* it by any means. If you use the code for your own projects please give */ 00012 /* me credit. Please send a bug report. Don't alter or remove this header! */ 00013 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 00055 //--------------------------------------------------------------------------- 00056 #include "fsMemMgr_NoT.h" 00057 //--------------------------------------------------------------------------- 00058 #if !defined(__FUNCTION__) 00059 # define __FUNCTION__ "???" // MSVC feature 00060 #endif // __FUNCTION__ 00061 //--------------------------------------------------------------------------- 00062 #if defined(FS_MMGR_ENABLE_TRACKING) || \ 00063 defined(FS_MMGR_ENABLE_POOLING) || \ 00064 defined(FS_MMGR_ENABLE_BASIC_STATS) \ 00065 00066 # define FS_MMGR_OWN_OPERATORS 00067 #endif 00068 //--------------------------------------------------------------------------- 00069 //--- DEFINE TRACKING MACROS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 00070 //--------------------------------------------------------------------------- 00071 #if defined(FS_MMGR_ENABLE_TRACKING) 00072 //--------------------------------------------------------------------------- 00073 #if defined(new) || defined(delete) 00074 # error Neither 'new' nor 'delete' should be defined here! 00075 #endif 00076 //--------------------------------------------------------------------------- 00083 #define new (fs::sys::mmgr::aux::Track(__FUNCTION__, __FILE__, \ 00084 __LINE__), false) ? 0 : new 00085 //--------------------------------------------------------------------------- 00093 #define delete (fs::sys::mmgr::aux::Track(__FUNCTION__, __FILE__, \ 00094 __LINE__), false) ? fs::sys::mmgr::aux::Track("", "", 0) : delete 00095 //--------------------------------------------------------------------------- 00096 #endif // FS_MMGR_ENABLE_TRACKING 00097 //--------------------------------------------------------------------------- 00098 //--- MEMORY MANAGER STUFF >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 00099 //--------------------------------------------------------------------------- 00100 #ifndef FS_SYS_MEMMGR_H 00101 #define FS_SYS_MEMMGR_H 00102 //--------------------------------------------------------------------------- 00103 namespace fs { namespace sys { 00104 //--------------------------------------------------------------------------- 00106 namespace mmgr { 00107 //--------------------------------------------------------------------------- 00109 void SetModNm(const char *pszModNm); 00110 //--------------------------------------------------------------------------- 00111 #if defined(FS_MMGR_ENABLE_TRACKING) 00113 namespace aux { 00115 void Track(const char *pszFunc, const char *pszFile, int nLine); 00116 } // namespace aux 00117 #endif // FS_MMGR_ENABLE_TRACKING 00118 //--------------------------------------------------------------------------- 00119 }}} // namespace fs::sys::mmgr 00120 //--------------------------------------------------------------------------- 00121 //--- MEMORY ALLOCATION OPERATORS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 00122 //--------------------------------------------------------------------------- 00123 #if defined(FS_MMGR_OWN_OPERATORS) 00124 //--------------------------------------------------------------------------- 00125 #include "fsMemMgr_NoT.h" // turn off the tracking macros for a while 00126 //--------------------------------------------------------------------------- 00128 void * operator new (size_t uSize); 00130 void operator delete (void *pAddr); 00132 void * operator new [] (size_t uSize); 00134 void operator delete [] (void *pAddr); 00135 //--------------------------------------------------------------------------- 00136 #include "fsMemMgr.h" // turn on the tracking macros 00137 //--------------------------------------------------------------------------- 00138 #endif // FS_MMGR_OWN_OPERATORS 00139 //--------------------------------------------------------------------------- 00140 //--- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 00141 //--------------------------------------------------------------------------- 00142 #endif // FS_SYS_MEMMGR_H