Changeset 46257 in vbox for trunk/src/VBox/Runtime/common/alloc
- Timestamp:
- May 24, 2013 7:18:27 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/alloc/memcache.cpp
r45903 r46257 123 123 /** Head of the page list. */ 124 124 PRTMEMCACHEPAGE pPageHead; 125 /** Poiner to the insertion point in the page list. */ 126 PRTMEMCACHEPAGE volatile *ppPageNext; 125 127 /** Constructor callback. */ 126 128 PFNMEMCACHECTOR pfnCtor; … … 210 212 && !pfnDtor; 211 213 pThis->pPageHead = NULL; 214 pThis->ppPageNext = &pThis->pPageHead; 212 215 pThis->pfnCtor = pfnCtor; 213 216 pThis->pfnDtor = pfnDtor; … … 245 248 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 246 249 AssertReturn(pThis->u32Magic == RTMEMCACHE_MAGIC, VERR_INVALID_HANDLE); 247 #ifdef RT_STRICT 250 251 #if 0 /*def RT_STRICT - don't require eveything to be freed. Caches are very convenient for lazy cleanup. */ 248 252 uint32_t cFree = pThis->cFree; 249 253 for (PRTMEMCACHEFREEOBJ pFree = pThis->pFreeTop; pFree && cFree < pThis->cTotal + 5; pFree = pFree->pNext) … … 333 337 ASMAtomicWritePtr(&pThis->pPageHint, pPage); 334 338 335 /* Link the page. */ 336 PRTMEMCACHEPAGE pPrevPage = pThis->pPageHead; 337 if (!pPrevPage) 338 ASMAtomicWritePtr(&pThis->pPageHead, pPage); 339 else 340 { 341 while (pPrevPage->pNext) 342 pPrevPage = pPrevPage->pNext; 343 ASMAtomicWritePtr(&pPrevPage->pNext, pPage); 344 } 339 /* Link the page in at the end of the list. */ 340 ASMAtomicWritePtr(pThis->ppPageNext, pPage); 341 pThis->ppPageNext = &pPage->pNext; 345 342 346 343 /* Add it to the page counts. */
Note:
See TracChangeset
for help on using the changeset viewer.