mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-08-27 17:54:47 +03:00
re-add deferred free and heap retired collect
This commit is contained in:
parent
c138fba149
commit
da17a59bdb
3 changed files with 11 additions and 5 deletions
13
src/page.c
13
src/page.c
|
@ -872,11 +872,14 @@ void* _mi_malloc_generic(mi_heap_t* heap, size_t size, bool zero, size_t huge_al
|
|||
}
|
||||
mi_assert_internal(mi_heap_is_initialized(heap));
|
||||
|
||||
// call potential deferred free routines
|
||||
// _mi_deferred_free(heap, false);
|
||||
|
||||
// free delayed frees from other threads (but skip contended ones)
|
||||
// _mi_heap_delayed_free_partial(heap);
|
||||
// collect every N generic mallocs
|
||||
if (heap->generic_count++ > 10000) {
|
||||
heap->generic_count = 0;
|
||||
// call potential deferred free routines
|
||||
_mi_deferred_free(heap, false);
|
||||
// collect retired pages
|
||||
_mi_heap_collect_retired(heap, false);
|
||||
}
|
||||
|
||||
// find (or allocate) a page of the right size
|
||||
mi_page_t* page = mi_find_page(heap, size, huge_alignment);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue