mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-07 11:58:41 +03:00
add delay to purg'ing; call collect_retired every N generic allocs
This commit is contained in:
parent
3330d4353a
commit
d2f670e6e5
4 changed files with 24 additions and 27 deletions
15
src/page.c
15
src/page.c
|
@ -870,16 +870,15 @@ void* _mi_malloc_generic(mi_heap_t* heap, size_t size, bool zero, size_t huge_al
|
|||
if mi_unlikely(!mi_heap_is_initialized(heap)) { return NULL; }
|
||||
}
|
||||
mi_assert_internal(mi_heap_is_initialized(heap));
|
||||
|
||||
// call potential deferred free routines
|
||||
_mi_deferred_free(heap, false);
|
||||
|
||||
|
||||
// collect every N generic mallocs
|
||||
/*static long count = 0;
|
||||
if (count++ > 100000) {
|
||||
count = 0;
|
||||
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