Fix delete operator to move _heapIdx closer to heap start
This commit is contained in:
parent
f6b027c591
commit
5b628e7ad7
@ -87,6 +87,13 @@ void operator delete(void *ptr) {
|
|||||||
if (prev && !prev->inUse) {
|
if (prev && !prev->inUse) {
|
||||||
prev->size += current->size;
|
prev->size += current->size;
|
||||||
prev->next = current->next;
|
prev->next = current->next;
|
||||||
|
current = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if current is closer heap start than _heapIdx, _heapIdx becomes
|
||||||
|
// current
|
||||||
|
if (current > _heapIdx) {
|
||||||
|
_heapIdx = current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user