use thread local stats for abandoned statistics to reduce contention

This commit is contained in:
Daan Leijen 2025-02-04 17:54:49 -08:00
parent b0c8d86c41
commit 8fc8da5d81
6 changed files with 44 additions and 17 deletions

View file

@ -357,6 +357,18 @@ mi_subproc_t* _mi_subproc(void) {
}
mi_tld_t* _mi_thread_tld(void) mi_attr_noexcept {
// should work without doing initialization (as it may be called from `_mi_tld -> mi_tld_alloc ... -> os_alloc -> _mi_subproc()`
mi_heap_t* heap = mi_prim_get_default_heap();
if (heap == NULL) {
return &tld_empty;
}
else {
return heap->tld;
}
}
/* -----------------------------------------------------------
Sub process
----------------------------------------------------------- */