diff options
author | daan <daanl@outlook.com> | 2021-11-23 19:04:41 -0800 |
---|---|---|
committer | daan <daanl@outlook.com> | 2021-11-23 19:04:41 -0800 |
commit | 9183b1eec005be9863e58d51ba0f96b97721d48c (patch) | |
tree | ac8b3da8e13fcb75d71a303b6d5619a083ed4dd1 /src/alloc.c | |
parent | 3548d8d716569f96967af4da0fdc57d2f09e7c38 (diff) |
remove experiment with unsafe_free_with_threadid
Diffstat (limited to 'src/alloc.c')
-rw-r--r-- | src/alloc.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/alloc.c b/src/alloc.c index e916784..ca32cab 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -475,12 +475,13 @@ static inline mi_segment_t* mi_checked_ptr_segment(const void* p, const char* ms return segment; } -// Free a block with a known threadid -static mi_decl_always_inline void _mi_free_with_threadid(void* p, mi_threadid_t tid) mi_attr_noexcept +// Free a block +void mi_free(void* p) mi_attr_noexcept { const mi_segment_t* const segment = mi_checked_ptr_segment(p,"mi_free"); if (mi_unlikely(segment == NULL)) return; + mi_threadid_t tid = _mi_thread_id(); mi_page_t* const page = _mi_segment_page_of(segment, p); mi_block_t* const block = (mi_block_t*)p; @@ -505,25 +506,6 @@ static mi_decl_always_inline void _mi_free_with_threadid(void* p, mi_threadid_t } } -// Get the current thread id -size_t mi_get_current_threadid(void) mi_attr_noexcept { - return _mi_thread_id(); -} - -// Free a block passing the current thread id explicitly -void mi_decl_noinline mi_unsafe_free_with_threadid(void* p, size_t current_tid ) mi_attr_noexcept -{ - mi_assert(current_tid == _mi_thread_id()); - _mi_free_with_threadid(p,current_tid); -} - - -// Free a block -void mi_decl_noinline mi_free(void* p) mi_attr_noexcept { - _mi_free_with_threadid(p, _mi_thread_id()); -} - - bool _mi_free_delayed_block(mi_block_t* block) { // get segment and page const mi_segment_t* const segment = _mi_ptr_segment(block); |