Initial cut at a lazy decommit strategy.
This does not deallocate memory until the OS tells us that we are short on memory, then tries to decommit all of the cached chunks (except for the first page, used for the linked lists). Nowhere near enough testing to commit to master yet!
This commit is contained in:
committed by
David Chisnall
parent
7a9ce97166
commit
66cec23b23
@@ -999,6 +999,15 @@ namespace snmalloc
|
||||
(void*)((size_t)super + OS_PAGE_SIZE),
|
||||
SUPERSLAB_SIZE - OS_PAGE_SIZE);
|
||||
}
|
||||
else if constexpr (decommit_strategy == DecommitSuperLazy)
|
||||
{
|
||||
static_assert(
|
||||
std::remove_reference_t<decltype(
|
||||
large_allocator
|
||||
.memory_provider)>::supports_low_memory_notification,
|
||||
"A lazy decommit strategy cannot be implemented on platforms "
|
||||
"without low memory notifications");
|
||||
}
|
||||
|
||||
pagemap().clear_slab(super);
|
||||
large_allocator.dealloc(super, 0);
|
||||
|
||||
Reference in New Issue
Block a user