Commit 1cf2b355 by John Kessenich

Memory: Fix #705: don't use pool object after invoking destructor.

parent fd1d07da
...@@ -201,15 +201,15 @@ void TPoolAllocator::pop() ...@@ -201,15 +201,15 @@ void TPoolAllocator::pop()
currentPageOffset = stack.back().offset; currentPageOffset = stack.back().offset;
while (inUseList != page) { while (inUseList != page) {
// invoke destructor to free allocation list
inUseList->~tHeader();
tHeader* nextInUse = inUseList->nextPage; tHeader* nextInUse = inUseList->nextPage;
if (inUseList->pageCount > 1) if (inUseList->pageCount > 1) {
inUseList->~tHeader(); // currently, just a debug allocation checker
delete [] reinterpret_cast<char*>(inUseList); delete [] reinterpret_cast<char*>(inUseList);
else { } else {
inUseList->nextPage = freeList; inUseList->nextPage = freeList;
freeList = inUseList; freeList = inUseList;
// inUseList->~tHeader(); TODO: this should probably call the allocation checker, but not the destructor
// ...if the destructor actually overwrites nextPage, that would effect freeList->nextPage
} }
inUseList = nextInUse; inUseList = nextInUse;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment