mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-08 00:09:31 +03:00
merge from dev
This commit is contained in:
commit
e688d5cbc8
2 changed files with 6 additions and 4 deletions
|
@ -712,7 +712,7 @@ static void mi_arenas_unsafe_destroy(void) {
|
||||||
|
|
||||||
// Purge the arenas; if `force_purge` is true, amenable parts are purged even if not yet expired
|
// Purge the arenas; if `force_purge` is true, amenable parts are purged even if not yet expired
|
||||||
void _mi_arena_collect(bool force_purge, mi_stats_t* stats) {
|
void _mi_arena_collect(bool force_purge, mi_stats_t* stats) {
|
||||||
mi_arenas_try_purge(force_purge, true /* visit all */, stats);
|
mi_arenas_try_purge(force_purge, force_purge /* visit all? */, stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
// destroy owned arenas; this is unsafe and should only be done using `mi_option_destroy_on_exit`
|
// destroy owned arenas; this is unsafe and should only be done using `mi_option_destroy_on_exit`
|
||||||
|
|
|
@ -120,7 +120,7 @@ static void mi_heap_collect_ex(mi_heap_t* heap, mi_collect_t collect)
|
||||||
{
|
{
|
||||||
if (heap==NULL || !mi_heap_is_initialized(heap)) return;
|
if (heap==NULL || !mi_heap_is_initialized(heap)) return;
|
||||||
|
|
||||||
const bool force = collect >= MI_FORCE;
|
const bool force = (collect >= MI_FORCE);
|
||||||
_mi_deferred_free(heap, force);
|
_mi_deferred_free(heap, force);
|
||||||
|
|
||||||
// note: never reclaim on collect but leave it to threads that need storage to reclaim
|
// note: never reclaim on collect but leave it to threads that need storage to reclaim
|
||||||
|
@ -163,11 +163,13 @@ static void mi_heap_collect_ex(mi_heap_t* heap, mi_collect_t collect)
|
||||||
_mi_segment_thread_collect(&heap->tld->segments);
|
_mi_segment_thread_collect(&heap->tld->segments);
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect regions on program-exit (or shared library unload)
|
// if forced, collect thread data cache on program-exit (or shared library unload)
|
||||||
if (force && _mi_is_main_thread() && mi_heap_is_backing(heap)) {
|
if (force && _mi_is_main_thread() && mi_heap_is_backing(heap)) {
|
||||||
_mi_thread_data_collect(); // collect thread data cache
|
_mi_thread_data_collect(); // collect thread data cache
|
||||||
_mi_arena_collect(true /* force purge */, &heap->tld->stats);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// collect arenas
|
||||||
|
_mi_arena_collect(force /* force purge? */, &heap->tld->stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _mi_heap_collect_abandon(mi_heap_t* heap) {
|
void _mi_heap_collect_abandon(mi_heap_t* heap) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue