Changeset 97913 in vbox for trunk/src/VBox/Additions/common/VBoxGuest/lib/testcase
- Timestamp:
- Dec 30, 2022 2:22:15 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155003
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest/lib/testcase
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/testcase/tstVbglR0PhysHeap-1.cpp
r97904 r97913 39 39 * Header Files * 40 40 *********************************************************************************************************************************/ 41 #include <iprt/heap.h>42 43 41 #include <iprt/assert.h> 44 42 #include <iprt/errcore.h> 45 43 #include <iprt/initterm.h> 46 44 #include <iprt/log.h> 45 #include <iprt/mem.h> 47 46 #include <iprt/rand.h> 48 47 #include <iprt/stream.h> … … 52 51 #include <iprt/time.h> 53 52 53 #define IN_TESTCASE 54 #define IN_RING0 /* pretend we're in ring-0 so we get access to the functions */ 55 #include "../VBoxGuestR0LibInternal.h" 56 57 58 /********************************************************************************************************************************* 59 * Structures and Typedefs * 60 *********************************************************************************************************************************/ 61 typedef struct 62 { 63 uint32_t cb; 64 void *pv; 65 } TSTHISTORYENTRY; 66 67 68 /********************************************************************************************************************************* 69 * Global Variables * 70 *********************************************************************************************************************************/ 71 VBGLDATA g_vbgldata; 72 73 int g_cChunks = 0; 74 size_t g_cbChunks = 0; 75 76 /** Drop-in replacement for RTMemContAlloc */ 77 static void *tstMemContAlloc(PRTCCPHYS pPhys, size_t cb) 78 { 79 RTTESTI_CHECK(cb > 0); 80 81 #define TST_MAX_CHUNKS 24 82 if (g_cChunks < TST_MAX_CHUNKS) 83 { 84 void *pvRet = RTMemAlloc(cb); 85 if (pvRet) 86 { 87 g_cChunks++; 88 g_cbChunks += cb; 89 *pPhys = (uint32_t)(uintptr_t)pvRet ^ UINT32_C(0xf0f0f000); 90 return pvRet; 91 } 92 } 93 94 *pPhys = NIL_RTCCPHYS; 95 return NULL; 96 } 97 98 99 /** Drop-in replacement for RTMemContFree */ 100 static void tstMemContFree(void *pv, size_t cb) 101 { 102 RTTESTI_CHECK(RT_VALID_PTR(pv)); 103 RTTESTI_CHECK(cb > 0); 104 RTTESTI_CHECK(g_cChunks > 0); 105 RTMemFree(pv); 106 g_cChunks--; 107 g_cbChunks -= cb; 108 } 109 110 111 #define RTMemContAlloc tstMemContAlloc 112 #define RTMemContFree tstMemContFree 113 #include "../VBoxGuestR0LibPhysHeap.cpp" 114 115 116 static void PrintStats(TSTHISTORYENTRY const *paHistory, size_t cHistory, const char *pszDesc) 117 { 118 size_t cbAllocated = 0; 119 unsigned cLargeBlocks = 0; 120 unsigned cAllocated = 0; 121 for (size_t i = 0; i < cHistory; i++) 122 if (paHistory[i].pv) 123 { 124 cAllocated += 1; 125 cbAllocated += paHistory[i].cb; 126 cLargeBlocks += paHistory[i].cb > _1K; 127 } 128 129 size_t const cbOverhead = g_cChunks * sizeof(VBGLPHYSHEAPCHUNK) + cAllocated * sizeof(VBGLPHYSHEAPBLOCK); 130 size_t const cbFragmentation = g_cbChunks - cbOverhead - cbAllocated; 131 RTTestIPrintf(RTTESTLVL_ALWAYS, 132 "%s: %'9zu bytes in %2d chunks; %'9zu bytes in %4u blocks (%2u large)\n" 133 " => int-frag %'9zu (%2zu.%1zu%%) overhead %'9zu (%1zu.%02zu%%)\n", 134 pszDesc, 135 g_cbChunks, g_cChunks, 136 cbAllocated, cAllocated, cLargeBlocks, 137 cbFragmentation, cbFragmentation * 100 / g_cbChunks, (cbFragmentation * 1000 / g_cbChunks) % 10, 138 cbOverhead, cbOverhead * 100 / g_cbChunks, (cbOverhead * 10000 / g_cbChunks) % 100); 139 } 140 54 141 55 142 int main(int argc, char **argv) … … 61 148 */ 62 149 RTTEST hTest; 63 int rc = RTTestInitAndCreate("tst RTHeapOffset", &hTest);150 int rc = RTTestInitAndCreate("tstVbglR0PhysHeap-1", &hTest); 64 151 if (rc) 65 152 return rc; … … 70 157 */ 71 158 RTTestSub(hTest, "Basics"); 72 static uint8_t s_abMem[128*1024]; 73 RTHEAPOFFSET Heap; 74 RTTESTI_CHECK_RC(rc = RTHeapOffsetInit(&Heap, &s_abMem[1], sizeof(s_abMem) - 1), VINF_SUCCESS); 159 RTTESTI_CHECK_RC(rc = VbglR0PhysHeapInit(), VINF_SUCCESS); 75 160 if (RT_FAILURE(rc)) 76 161 return RTTestSummaryAndDestroy(hTest); … … 79 164 * Try allocate. 80 165 */ 81 static struct Tst HeapOffsetOps82 { 83 size_tcb;84 unsigned uAlignment;166 static struct TstPhysHeapOps 167 { 168 uint32_t cb; 169 unsigned iFreeOrder; 85 170 void *pvAlloc; 86 unsigned iFreeOrder;87 171 } s_aOps[] = 88 172 { 89 { 16, 0, NULL, 0}, // 090 { 16, 4, NULL, 1},91 { 16, 8, NULL, 2},92 { 16, 16, NULL, 5},93 { 16, 32, NULL, 4},94 { 32, 0, NULL, 3}, // 595 { 31, 0, NULL, 6},96 { 1024, 0, NULL, 8},97 { 1024, 32, NULL, 10},98 { 1024, 32, NULL, 12},99 { PAGE_SIZE, PAGE_SIZE, NULL, 13}, // 10100 { 1024, 32, NULL, 9},101 { PAGE_SIZE, 32, NULL, 11},102 { PAGE_SIZE, PAGE_SIZE, NULL, 14},103 { 16, 0, NULL, 15},104 { 9, 0, NULL, 7}, // 15105 { 16, 0, NULL, 7},106 { 36, 0, NULL, 7},107 { 16, 0, NULL, 7},108 { 12344, 0, NULL, 7},109 { 50, 0, NULL, 7}, // 20110 { 16, 0, NULL, 7},173 { 16, 0, NULL }, // 0 174 { 16, 1, NULL }, 175 { 16, 2, NULL }, 176 { 16, 5, NULL }, 177 { 16, 4, NULL }, 178 { 32, 3, NULL }, // 5 179 { 31, 6, NULL }, 180 { 1024, 8, NULL }, 181 { 1024, 10, NULL }, 182 { 1024, 12, NULL }, 183 { PAGE_SIZE, 13, NULL }, // 10 184 { 1024, 9, NULL }, 185 { PAGE_SIZE, 11, NULL }, 186 { PAGE_SIZE, 14, NULL }, 187 { 16, 15, NULL }, 188 { 9, 7, NULL }, // 15 189 { 16, 7, NULL }, 190 { 36, 7, NULL }, 191 { 16, 7, NULL }, 192 { 12344, 7, NULL }, 193 { 50, 7, NULL }, // 20 194 { 16, 7, NULL }, 111 195 }; 112 196 uint32_t i; 113 RTHeapOffsetDump(Heap, (PFNRTHEAPOFFSETPRINTF)(uintptr_t)RTPrintf); /** @todo Add some detail info output with a signature identical to RTPrintf. */114 size_t cbBefore = RTHeapOffsetGetFreeSize(Heap);197 //RTHeapOffsetDump(Heap, (PFNRTHEAPOFFSETPRINTF)(uintptr_t)RTPrintf); /** @todo Add some detail info output with a signature identical to RTPrintf. */ 198 //size_t cbBefore = VbglR0PhysHeapGetFreeSize(); 115 199 static char const s_szFill[] = "01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 116 200 … … 118 202 for (i = 0; i < RT_ELEMENTS(s_aOps); i++) 119 203 { 120 s_aOps[i].pvAlloc = RTHeapOffsetAlloc(Heap, s_aOps[i].cb, s_aOps[i].uAlignment);121 RTTESTI_CHECK_MSG(s_aOps[i].pvAlloc, (" RTHeapOffsetAlloc(%p, %#x, %#x,) -> NULL i=%d\n", (void *)Heap, s_aOps[i].cb, s_aOps[i].uAlignment, i));204 s_aOps[i].pvAlloc = VbglR0PhysHeapAlloc(s_aOps[i].cb); 205 RTTESTI_CHECK_MSG(s_aOps[i].pvAlloc, ("VbglR0PhysHeapAlloc(%#x) -> NULL i=%d\n", s_aOps[i].cb, i)); 122 206 if (!s_aOps[i].pvAlloc) 123 207 return RTTestSummaryAndDestroy(hTest); 124 208 125 209 memset(s_aOps[i].pvAlloc, s_szFill[i], s_aOps[i].cb); 126 RTTESTI_CHECK_MSG(RT_ALIGN_P(s_aOps[i].pvAlloc, (s_aOps[i].uAlignment ? s_aOps[i].uAlignment : 8)) == s_aOps[i].pvAlloc,127 (" RTHeapOffsetAlloc(%p, %#x, %#x,) -> %p\n", (void *)Heap, s_aOps[i].cb, s_aOps[i].uAlignment, i));210 RTTESTI_CHECK_MSG(RT_ALIGN_P(s_aOps[i].pvAlloc, sizeof(void *)) == s_aOps[i].pvAlloc, 211 ("VbglR0PhysHeapAlloc(%#x) -> %p\n", s_aOps[i].cb, i)); 128 212 if (!s_aOps[i].pvAlloc) 129 213 return RTTestSummaryAndDestroy(hTest); … … 137 221 //RTPrintf("debug: i=%d pv=%#x cb=%#zx align=%#zx cbReal=%#zx\n", i, s_aOps[i].pvAlloc, 138 222 // s_aOps[i].cb, s_aOps[i].uAlignment, RTHeapOffsetSize(Heap, s_aOps[i].pvAlloc)); 139 size_t cbBeforeSub = RTHeapOffsetGetFreeSize(Heap);140 RTHeapOffsetFree(Heap,s_aOps[i].pvAlloc);141 size_t cbAfterSubFree = RTHeapOffsetGetFreeSize(Heap);223 size_t cbBeforeSub = VbglR0PhysHeapGetFreeSize(); 224 VbglR0PhysHeapFree(s_aOps[i].pvAlloc); 225 size_t cbAfterSubFree = VbglR0PhysHeapGetFreeSize(); 142 226 143 227 void *pv; 144 pv = RTHeapOffsetAlloc(Heap, s_aOps[i].cb, s_aOps[i].uAlignment);145 RTTESTI_CHECK_MSG(pv, (" RTHeapOffsetAlloc(%p, %#x, %#x,) -> NULL i=%d\n", (void *)Heap, s_aOps[i].cb, s_aOps[i].uAlignment, i));228 pv = VbglR0PhysHeapAlloc(s_aOps[i].cb); 229 RTTESTI_CHECK_MSG(pv, ("VbglR0PhysHeapAlloc(%#x) -> NULL i=%d\n", s_aOps[i].cb, i)); 146 230 if (!pv) 147 231 return RTTestSummaryAndDestroy(hTest); 148 232 //RTPrintf("debug: i=%d pv=%p cbReal=%#zx cbBeforeSub=%#zx cbAfterSubFree=%#zx cbAfterSubAlloc=%#zx \n", i, pv, RTHeapOffsetSize(Heap, pv), 149 // cbBeforeSub, cbAfterSubFree, RTHeapOffsetGetFreeSize(Heap));233 // cbBeforeSub, cbAfterSubFree, VbglR0PhysHeapGetFreeSize()); 150 234 151 235 if (pv != s_aOps[i].pvAlloc) 152 236 RTTestIPrintf(RTTESTLVL_ALWAYS, "Warning: Free+Alloc returned different address. new=%p old=%p i=%d\n", pv, s_aOps[i].pvAlloc, i); 153 237 s_aOps[i].pvAlloc = pv; 154 size_t cbAfterSubAlloc = RTHeapOffsetGetFreeSize(Heap);238 size_t cbAfterSubAlloc = VbglR0PhysHeapGetFreeSize(); 155 239 if (cbBeforeSub != cbAfterSubAlloc) 156 240 { … … 161 245 } 162 246 163 /* make a copy of the heap and the to-be-freed list. */ 164 static uint8_t s_abMemCopy[sizeof(s_abMem)]; 165 memcpy(s_abMemCopy, s_abMem, sizeof(s_abMem)); 166 uintptr_t offDelta = (uintptr_t)&s_abMemCopy[0] - (uintptr_t)&s_abMem[0]; 167 RTHEAPOFFSET hHeapCopy = (RTHEAPOFFSET)((uintptr_t)Heap + offDelta); 168 static struct TstHeapOffsetOps s_aOpsCopy[RT_ELEMENTS(s_aOps)]; 169 memcpy(&s_aOpsCopy[0], &s_aOps[0], sizeof(s_aOps)); 170 171 /* free it in a specific order. */ 172 int cFreed = 0; 173 for (i = 0; i < RT_ELEMENTS(s_aOps); i++) 174 { 175 unsigned j; 176 for (j = 0; j < RT_ELEMENTS(s_aOps); j++) 177 { 178 if ( s_aOps[j].iFreeOrder != i 179 || !s_aOps[j].pvAlloc) 180 continue; 181 //RTPrintf("j=%d i=%d free=%d cb=%d pv=%p\n", j, i, RTHeapOffsetGetFreeSize(Heap), s_aOps[j].cb, s_aOps[j].pvAlloc); 182 RTHeapOffsetFree(Heap, s_aOps[j].pvAlloc); 183 s_aOps[j].pvAlloc = NULL; 184 cFreed++; 185 } 186 } 187 RTTESTI_CHECK(cFreed == RT_ELEMENTS(s_aOps)); 188 RTTestIPrintf(RTTESTLVL_ALWAYS, "i=done free=%d\n", RTHeapOffsetGetFreeSize(Heap)); 189 190 /* check that we're back at the right amount of free memory. */ 191 size_t cbAfter = RTHeapOffsetGetFreeSize(Heap); 192 if (cbBefore != cbAfter) 193 { 194 RTTestIPrintf(RTTESTLVL_ALWAYS, 195 "Warning: Either we've split out an alignment chunk at the start, or we've got\n" 196 " an alloc/free accounting bug: cbBefore=%d cbAfter=%d\n", cbBefore, cbAfter); 197 RTHeapOffsetDump(Heap, (PFNRTHEAPOFFSETPRINTF)(uintptr_t)RTPrintf); 198 } 199 200 /* relocate and free the bits in heap2 now. */ 201 RTTestSub(hTest, "Relocated Heap"); 202 /* free it in a specific order. */ 203 int cFreed2 = 0; 204 for (i = 0; i < RT_ELEMENTS(s_aOpsCopy); i++) 205 { 206 unsigned j; 207 for (j = 0; j < RT_ELEMENTS(s_aOpsCopy); j++) 208 { 209 if ( s_aOpsCopy[j].iFreeOrder != i 210 || !s_aOpsCopy[j].pvAlloc) 211 continue; 212 //RTPrintf("j=%d i=%d free=%d cb=%d pv=%p\n", j, i, RTHeapOffsetGetFreeSize(hHeapCopy), s_aOpsCopy[j].cb, s_aOpsCopy[j].pvAlloc); 213 RTHeapOffsetFree(hHeapCopy, (uint8_t *)s_aOpsCopy[j].pvAlloc + offDelta); 214 s_aOpsCopy[j].pvAlloc = NULL; 215 cFreed2++; 216 } 217 } 218 RTTESTI_CHECK(cFreed2 == RT_ELEMENTS(s_aOpsCopy)); 219 220 /* check that we're back at the right amount of free memory. */ 221 size_t cbAfterCopy = RTHeapOffsetGetFreeSize(hHeapCopy); 222 RTTESTI_CHECK_MSG(cbAfterCopy == cbAfter, ("cbAfterCopy=%zu cbAfter=%zu\n", cbAfterCopy, cbAfter)); 247 VbglR0PhysHeapTerminate(); 248 RTTESTI_CHECK_MSG(g_cChunks == 0, ("g_cChunks=%d\n", g_cChunks)); 249 223 250 224 251 /* … … 226 253 */ 227 254 RTTestSub(hTest, "Random Test"); 228 RTTESTI_CHECK_RC(rc = RTHeapOffsetInit(&Heap, &s_abMem[1], sizeof(s_abMem) - 1), VINF_SUCCESS);255 RTTESTI_CHECK_RC(rc = VbglR0PhysHeapInit(), VINF_SUCCESS); 229 256 if (RT_FAILURE(rc)) 230 257 return RTTestSummaryAndDestroy(hTest); … … 240 267 #endif 241 268 242 static struct 243 { 244 size_t cb; 245 void *pv; 246 } s_aHistory[1536]; 269 static TSTHISTORYENTRY s_aHistory[3072]; 247 270 RT_ZERO(s_aHistory); 248 271 … … 252 275 if (!s_aHistory[i].pv) 253 276 { 254 uint32_t uAlignment = 1 << RTRandAdvU32Ex(hRand, 0, 7); 255 s_aHistory[i].cb = RTRandAdvU32Ex(hRand, 9, 1024); 256 s_aHistory[i].pv = RTHeapOffsetAlloc(Heap, s_aHistory[i].cb, uAlignment); 277 s_aHistory[i].cb = RTRandAdvU32Ex(hRand, 8, 1024); 278 s_aHistory[i].pv = VbglR0PhysHeapAlloc(s_aHistory[i].cb); 257 279 if (!s_aHistory[i].pv) 258 280 { 259 281 s_aHistory[i].cb = 9; 260 s_aHistory[i].pv = RTHeapOffsetAlloc(Heap, s_aHistory[i].cb, 0);282 s_aHistory[i].pv = VbglR0PhysHeapAlloc(s_aHistory[i].cb); 261 283 } 262 284 if (s_aHistory[i].pv) … … 265 287 else 266 288 { 267 RTHeapOffsetFree(Heap,s_aHistory[i].pv);289 VbglR0PhysHeapFree(s_aHistory[i].pv); 268 290 s_aHistory[i].pv = NULL; 269 291 } 270 292 293 #if 1 294 /* Check heap integrity: */ 295 RTTESTI_CHECK_RC_OK(VbglR0PhysHeapCheck(NULL)); 296 int cChunks = 0; 297 for (VBGLPHYSHEAPCHUNK *pCurChunk = g_vbgldata.pChunkHead; pCurChunk; pCurChunk = pCurChunk->pNext) 298 cChunks++; 299 RTTESTI_CHECK_MSG(cChunks == g_cChunks, ("g_cChunks=%u, but only %u chunks in the list!\n", g_cChunks, cChunks)); 300 #endif 301 271 302 if ((iTest % 7777) == 7776) 272 303 { 273 304 /* exhaust the heap */ 274 for (i = 0; i < RT_ELEMENTS(s_aHistory) && RTHeapOffsetGetFreeSize(Heap) >= 256; i++) 305 PrintStats(s_aHistory, RT_ELEMENTS(s_aHistory), "Exhaust-pre "); 306 307 for (i = 0; i < RT_ELEMENTS(s_aHistory) && (VbglR0PhysHeapGetFreeSize() >= 256 || g_cChunks < TST_MAX_CHUNKS); i++) 275 308 if (!s_aHistory[i].pv) 276 309 { 277 s_aHistory[i].cb = RTRandAdvU32Ex(hRand, 256, 16384); 278 s_aHistory[i].pv = RTHeapOffsetAlloc(Heap, s_aHistory[i].cb, 0); 310 s_aHistory[i].cb = RTRandAdvU32Ex(hRand, VBGL_PH_CHUNKSIZE / 8, VBGL_PH_CHUNKSIZE / 2 + VBGL_PH_CHUNKSIZE / 4); 311 s_aHistory[i].pv = VbglR0PhysHeapAlloc(s_aHistory[i].cb); 312 if (s_aHistory[i].pv) 313 memset(s_aHistory[i].pv, 0x55, s_aHistory[i].cb); 279 314 } 280 for (i = 0; i < RT_ELEMENTS(s_aHistory) && RTHeapOffsetGetFreeSize(Heap); i++) 281 { 282 if (!s_aHistory[i].pv) 283 { 284 s_aHistory[i].cb = 1; 285 s_aHistory[i].pv = RTHeapOffsetAlloc(Heap, s_aHistory[i].cb, 1); 286 } 287 if (s_aHistory[i].pv) 288 memset(s_aHistory[i].pv, 0x55, s_aHistory[i].cb); 289 } 290 RTTESTI_CHECK_MSG(RTHeapOffsetGetFreeSize(Heap) == 0, ("%zu\n", RTHeapOffsetGetFreeSize(Heap))); 315 316 size_t cbFree = VbglR0PhysHeapGetFreeSize(); 317 if (cbFree) 318 for (i = 0; i < RT_ELEMENTS(s_aHistory); i++) 319 if (!s_aHistory[i].pv) 320 { 321 s_aHistory[i].cb = RTRandAdvU32Ex(hRand, 1, (uint32_t)cbFree); 322 s_aHistory[i].pv = VbglR0PhysHeapAlloc(s_aHistory[i].cb); 323 while (s_aHistory[i].pv == NULL && s_aHistory[i].cb > 2) 324 { 325 s_aHistory[i].cb >>= 1; 326 s_aHistory[i].pv = VbglR0PhysHeapAlloc(s_aHistory[i].cb); 327 } 328 if (s_aHistory[i].pv) 329 memset(s_aHistory[i].pv, 0x55, s_aHistory[i].cb); 330 331 cbFree = VbglR0PhysHeapGetFreeSize(); 332 if (!cbFree) 333 break; 334 } 335 336 RTTESTI_CHECK_MSG(VbglR0PhysHeapGetFreeSize() == 0, ("%zu\n", VbglR0PhysHeapGetFreeSize())); 337 PrintStats(s_aHistory, RT_ELEMENTS(s_aHistory), "Exhaust-post"); 291 338 } 292 339 else if ((iTest % 7777) == 1111) … … 295 342 for (i = 0; i < RT_ELEMENTS(s_aHistory); i++) 296 343 { 297 RTHeapOffsetFree(Heap,s_aHistory[i].pv);344 VbglR0PhysHeapFree(s_aHistory[i].pv); 298 345 s_aHistory[i].pv = NULL; 299 346 } 300 size_t cbAfterRand = RTHeapOffsetGetFreeSize(Heap); 301 RTTESTI_CHECK_MSG(cbAfterRand == cbAfter, ("cbAfterRand=%zu cbAfter=%zu\n", cbAfterRand, cbAfter)); 347 RTTESTI_CHECK_MSG(g_cChunks == 1, ("g_cChunks=%d\n", g_cChunks)); 348 #if 0 349 for (VBGLPHYSHEAPCHUNK *pCurChunk = g_vbgldata.pChunkHead; pCurChunk; pCurChunk = pCurChunk->pNext) 350 { 351 RTTestIPrintf(RTTESTLVL_ALWAYS, "pCurChunk=%p: cAllocatedBlocks=%d\n", pCurChunk, pCurChunk->cAllocatedBlocks); 352 uintptr_t const uEnd = (uintptr_t)pCurChunk + pCurChunk->cbSize; 353 const VBGLPHYSHEAPBLOCK *pCurBlock = (const VBGLPHYSHEAPBLOCK *)(pCurChunk + 1); 354 unsigned iCurBlock = 0; 355 while ((uintptr_t)pCurBlock < uEnd) 356 { 357 RTTestIPrintf(RTTESTLVL_ALWAYS, " #%2u/%p: cb=%#x %s byte0=%02x\n", 358 iCurBlock, pCurBlock, pCurBlock->cbDataSize, pCurBlock->fu32Flags ? "alloc" : "free", 359 *(uint8_t const *)(pCurBlock + 1)); 360 pCurBlock = (const VBGLPHYSHEAPBLOCK *)((uintptr_t)(pCurBlock + 1) + pCurBlock->cbDataSize); 361 iCurBlock++; 362 } 363 } 364 #endif 365 366 //size_t cbAfterRand = VbglR0PhysHeapGetFreeSize(); 367 //RTTESTI_CHECK_MSG(cbAfterRand == cbAfter, ("cbAfterRand=%zu cbAfter=%zu\n", cbAfterRand, cbAfter)); 302 368 } 303 369 } … … 306 372 for (i = 0; i < RT_ELEMENTS(s_aHistory); i++) 307 373 { 308 RTHeapOffsetFree(Heap,s_aHistory[i].pv);374 VbglR0PhysHeapFree(s_aHistory[i].pv); 309 375 s_aHistory[i].pv = NULL; 310 376 } 311 377 312 /* check that we're back at the right amount of free memory. */ 313 size_t cbAfterRand = RTHeapOffsetGetFreeSize(Heap); 314 RTTESTI_CHECK_MSG(cbAfterRand == cbAfter, ("cbAfterRand=%zu cbAfter=%zu\n", cbAfterRand, cbAfter)); 378 RTTESTI_CHECK_MSG(g_cChunks == 1, ("g_cChunks=%d\n", g_cChunks)); 379 380 VbglR0PhysHeapTerminate(); 381 RTTESTI_CHECK_MSG(g_cChunks == 0, ("g_cChunks=%d\n", g_cChunks)); 315 382 316 383 RTTESTI_CHECK_RC(rc = RTRandAdvDestroy(hRand), VINF_SUCCESS);
Note:
See TracChangeset
for help on using the changeset viewer.