diff options
author | Daan Leijen <Daan@microsoft.com> | 2019-08-21 08:06:40 -0700 |
---|---|---|
committer | Daan Leijen <Daan@microsoft.com> | 2019-08-21 08:09:28 -0700 |
commit | 12257e5bc1f3c201e870000e501552475ae33e69 (patch) | |
tree | e48d17f741bd9c99a87bfabe3cc0a65dac8db797 /include/mimalloc-internal.h | |
parent | ff88361329d16dc629c61abe63a285e5c977ce80 (diff) |
fix thread-id reset on page abandonment
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r-- | include/mimalloc-internal.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h index e4bb138..6455d57 100644 --- a/include/mimalloc-internal.h +++ b/include/mimalloc-internal.h @@ -323,7 +323,13 @@ static inline uintptr_t mi_page_thread_id(const mi_page_t* page) { } static inline void mi_page_init_flags(mi_page_t* page, uintptr_t thread_id) { - page->flags = thread_id; + mi_assert_internal((thread_id & MI_PAGE_FLAGS_MASK) == 0); + page->flags = thread_id; +} + +static inline void mi_page_set_thread_id(mi_page_t* page, uintptr_t thread_id) { + mi_assert_internal((thread_id & MI_PAGE_FLAGS_MASK) == 0); + page->flags = thread_id | (page->flags & MI_PAGE_FLAGS_MASK); } static inline bool mi_page_is_in_full(const mi_page_t* page) { |