Fix delete operator to move _heapIdx closer to heap start

This commit is contained in:
Gary Talent 2017-10-14 12:49:30 -05:00
parent f6b027c591
commit 5b628e7ad7

View File

@ -87,6 +87,13 @@ void operator delete(void *ptr) {
if (prev && !prev->inUse) {
prev->size += current->size;
prev->next = current->next;
current = prev;
}
// if current is closer heap start than _heapIdx, _heapIdx becomes
// current
if (current > _heapIdx) {
_heapIdx = current;
}
}
}