base: free up all blocks on avl destruction

Issue #3111

remove_range may deny to the job on memory pressure or insane ranges,
which ends up in an endless loop when the Avl allocator is in destruction.

Since the Avl gets destructed, solely the memory free up is of importance,
not the correct range adjustments during remove_range.
This commit is contained in:
Alexander Boettcher 2019-04-10 10:50:53 +02:00 committed by Christian Helmuth
parent 526554741f
commit 35cf804471

View File

@ -183,9 +183,13 @@ void Allocator_avl_base::_revert_allocations_and_ranges()
(dangling_allocations > 1) ? "s" : "",
" at allocator destruction time");
/* remove ranges */
while (Block *block = _addr_tree.first())
remove_range(block->addr(), block->size());
/* destroy all remaining blocks */
while (Block *block = _addr_tree.first()) {
if (remove_range(block->addr(), block->size())) {
/* if the invocation fails, release the block to break endless loop */
_destroy_block(block);
}
}
}