mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
use thread local stats for abandoned statistics to reduce contention
This commit is contained in:
parent
b0c8d86c41
commit
8fc8da5d81
6 changed files with 44 additions and 17 deletions
12
src/init.c
12
src/init.c
|
@ -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
|
||||
----------------------------------------------------------- */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue