Skip to content
Snippets Groups Projects
Commit 698bf754 authored by John Kessenich's avatar John Kessenich
Browse files

Memory: Mak full explicit destructor functionality, techincally correctly.

Completes a TODO from previous commit.
parent 1cf2b355
No related branches found
No related tags found
No related merge requests found
......@@ -202,14 +202,17 @@ void TPoolAllocator::pop()
while (inUseList != page) {
tHeader* nextInUse = inUseList->nextPage;
if (inUseList->pageCount > 1) {
inUseList->~tHeader(); // currently, just a debug allocation checker
size_t pageCount = inUseList->pageCount;
// This technically ends the lifetime of the header as C++ object,
// but we will still control the memory and reuse it.
inUseList->~tHeader(); // currently, just a debug allocation checker
if (pageCount > 1) {
delete [] reinterpret_cast<char*>(inUseList);
} else {
inUseList->nextPage = freeList;
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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment