diff options
author | Daan Leijen <daan@microsoft.com> | 2021-02-02 10:46:43 -0800 |
---|---|---|
committer | Daan Leijen <daan@microsoft.com> | 2021-02-02 10:46:43 -0800 |
commit | 1b22da3c283ec02987ed1051a6b9d4358b4dd52a (patch) | |
tree | a78d956dbef365eb42e82a2f4603c151531826b4 /include/mimalloc-internal.h | |
parent | ba84aa278388d439724b5376c7f86794a43023fa (diff) | |
parent | 331491e1e80da8f99321c9261b17463f3b32ade5 (diff) |
Merge branch 'dev' into dev-slice
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r-- | include/mimalloc-internal.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h index 9c898c4..540d389 100644 --- a/include/mimalloc-internal.h +++ b/include/mimalloc-internal.h @@ -336,10 +336,14 @@ static inline mi_heap_t** mi_tls_pthread_heap_slot(void) { #elif defined(MI_TLS_PTHREAD) #include <pthread.h> extern pthread_key_t _mi_heap_default_key; -#else -extern mi_decl_thread mi_heap_t* _mi_heap_default; // default heap to allocate from #endif +// Default heap to allocate from (if not using TLS- or pthread slots). +// Do not use this directly but use through `mi_heap_get_default()` (or the unchecked `mi_get_default_heap`). +// This thread local variable is only used when neither MI_TLS_SLOT, MI_TLS_PTHREAD, or MI_TLS_PTHREAD_SLOT_OFS are defined. +// However, on the Apple M1 we do use the address of this variable as the unique thread-id (issue #356). +extern mi_decl_thread mi_heap_t* _mi_heap_default; // default heap to allocate from + static inline mi_heap_t* mi_get_default_heap(void) { #if defined(MI_TLS_SLOT) mi_heap_t* heap = (mi_heap_t*)mi_tls_slot(MI_TLS_SLOT); |