vbox的更動 32125 路徑 trunk/src/VBox/Runtime/r3/alloc.cpp
- 時間撮記:
- 2010-8-31 上午10:16:05 (14 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/r3/alloc.cpp
r31274 r32125 42 42 #include <iprt/asm.h> 43 43 #include <iprt/assert.h> 44 #ifdef RTMEMALLOC_USE_TRACKER 45 # include <iprt/memtracker.h> 46 #endif 44 47 #include <iprt/param.h> 45 48 #include <iprt/string.h> … … 95 98 96 99 AssertMsg(cb, ("Allocating ZERO bytes is really not a good idea! Good luck with the next assertion!\n")); 100 # ifdef RTMEMALLOC_USE_TRACKER 101 void *pv = RTMemTrackerHdrAlloc(malloc(cb + sizeof(RTMEMTRACKERHDR)), cb, pszTag, RTMEMTRACKERMETHOD_ALLOC); 102 # else 97 103 void *pv = malloc(cb); 104 # endif 98 105 AssertMsg(pv, ("malloc(%#zx) failed!!!\n", cb)); 99 106 AssertMsg( cb < RTMEM_ALIGNMENT … … 115 122 AssertMsg(cb, ("Allocating ZERO bytes is really not a good idea! Good luck with the next assertion!\n")); 116 123 124 # ifdef RTMEMALLOC_USE_TRACKER 125 void *pv = RTMemTrackerHdrAlloc(calloc(1, cb + sizeof(RTMEMTRACKERHDR)), cb, pszTag, RTMEMTRACKERMETHOD_ALLOCZ); 126 #else 117 127 void *pv = calloc(1, cb); 128 #endif 118 129 AssertMsg(pv, ("calloc(1,%#zx) failed!!!\n", cb)); 119 130 AssertMsg( cb < RTMEM_ALIGNMENT … … 165 176 #else /* !RTALLOC_USE_EFENCE */ 166 177 178 # ifdef RTALLOC_USE_TRACKER 179 void *pv; 180 if (!pvOld) 181 { 182 if (cbNew) 183 pv = RTMemTrackerHdrAlloc(realloc(pvOld, cbNew + sizeof(RTMEMTRACKERHDR)), cbNew, 184 pszTag, RTMEMTRACKERMETHOD_REALLOC); 185 else 186 pv = NULL; 187 } 188 else 189 { 190 RTMemTrackerHdrReallocPrep(pvOld, 0, pszTag, RTMEMTRACKERMETHOD_REALLOC); 191 pv = RTMemTrackerHdrRealloc(realloc(pvOld, cbNew + sizeof(RTMEMTRACKERHDR)), cbNew, pvOld, 192 pszTag, RTMEMTRACKERMETHOD_REALLOC); 193 } 194 # else 167 195 void *pv = realloc(pvOld, cbNew); 196 # endif 168 197 AssertMsg(pv || !cbNew, ("realloc(%p, %#zx) failed!!!\n", pvOld, cbNew)); 169 198 AssertMsg( cbNew < RTMEM_ALIGNMENT … … 182 211 rtR3MemFree("Free", RTMEMTYPE_RTMEMFREE, pv, ASMReturnAddress(), NULL, 0, NULL); 183 212 #else 213 # ifdef RTALLOC_USE_TRACKER 214 pv = RTMemTrackerHdrFree(pv, 0, NULL, RTMEMTRACKERMETHOD_FREE); 215 # endif 184 216 free(pv); 185 217 #endif
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器