From abcaa4a4f2e48dadb24b64b8984243c3cd777ce3 Mon Sep 17 00:00:00 2001 From: Daan Date: Thu, 24 Sep 2020 10:38:18 -0700 Subject: [PATCH 1/4] Update readme.md link to mi_process_info --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 2821802e..bf879d49 100644 --- a/readme.md +++ b/readme.md @@ -74,7 +74,7 @@ Enjoy! ### Releases * 2020-09-24, `v1.6.6`: stable release 1.6: using standard C atomics, passing tsan testing, improved - handling of failing to commit on Windows, add `mi_process_info` api call. + handling of failing to commit on Windows, add [`mi_process_info`](https://github.com/microsoft/mimalloc/blob/master/include/mimalloc.h#L156) api call. * 2020-08-06, `v1.6.4`: stable release 1.6: improved error recovery in low-memory situations, support for IllumOS and Haiku, NUMA support for Vista/XP, improved NUMA detection for AMD Ryzen, ubsan support. * 2020-05-05, `v1.6.3`: stable release 1.6: improved behavior in out-of-memory situations, improved malloc zones on macOS, From 44d030ba9d63b2a4f1dcb78d8592928b228b1735 Mon Sep 17 00:00:00 2001 From: daan Date: Thu, 24 Sep 2020 16:28:25 -0700 Subject: [PATCH 2/4] fuse used decrement with test for slightly better codegen --- src/alloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 2cef8bcd..8e863a67 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -448,8 +448,7 @@ void mi_free(void* p) mi_attr_noexcept #endif mi_block_set_next(page, block, page->local_free); page->local_free = block; - page->used--; - if (mi_unlikely(mi_page_all_free(page))) { + if (mi_unlikely(--page->used == 0)) { // using this expression generates better code than: page->used--; if (mi_page_all_free(page)) _mi_page_retire(page); } } From 1233de73884732f8be6dc26354848bd948848405 Mon Sep 17 00:00:00 2001 From: daan Date: Thu, 24 Sep 2020 16:29:41 -0700 Subject: [PATCH 3/4] use relaxed load for region count as that is monotonic --- src/region.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/region.c b/src/region.c index aa4f95b5..b6d0da31 100644 --- a/src/region.c +++ b/src/region.c @@ -240,7 +240,7 @@ static bool mi_region_is_suitable(const mem_region_t* region, int numa_node, boo static bool mi_region_try_claim(int numa_node, size_t blocks, bool allow_large, mem_region_t** region, mi_bitmap_index_t* bit_idx, mi_os_tld_t* tld) { // try all regions for a free slot - const size_t count = mi_atomic_load_acquire(®ions_count); + const size_t count = mi_atomic_load_relaxed(®ions_count); // monotonic, so ok to be relaxed size_t idx = tld->region_idx; // Or start at 0 to reuse low addresses? Starting at 0 seems to increase latency though for (size_t visited = 0; visited < count; visited++, idx++) { if (idx >= count) idx = 0; // wrap around From 13a4030619edada133e1a3c06c6287ad5a9c74c1 Mon Sep 17 00:00:00 2001 From: daan Date: Thu, 24 Sep 2020 16:30:40 -0700 Subject: [PATCH 4/4] bump version to 1.6.7 --- include/mimalloc.h | 2 +- readme.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mimalloc.h b/include/mimalloc.h index 05cf92e4..254a7d9c 100644 --- a/include/mimalloc.h +++ b/include/mimalloc.h @@ -8,7 +8,7 @@ terms of the MIT license. A copy of the license can be found in the file #ifndef MIMALLOC_H #define MIMALLOC_H -#define MI_MALLOC_VERSION 166 // major + 2 digits minor +#define MI_MALLOC_VERSION 167 // major + 2 digits minor // ------------------------------------------------------ // Compiler specific attributes diff --git a/readme.md b/readme.md index bf879d49..9419a658 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ mimalloc (pronounced "me-malloc") is a general purpose allocator with excellent [performance](#performance) characteristics. Initially developed by Daan Leijen for the run-time systems of the [Koka](https://github.com/koka-lang/koka) and [Lean](https://github.com/leanprover/lean) languages. -Latest release:`v1.6.6` (2020-09-24). +Latest release:`v1.6.7` (2020-09-24). It is a drop-in replacement for `malloc` and can be used in other programs without code changes, for example, on dynamically linked ELF-based systems (Linux, BSD, etc.) you can use it as: @@ -73,7 +73,7 @@ Enjoy! ### Releases -* 2020-09-24, `v1.6.6`: stable release 1.6: using standard C atomics, passing tsan testing, improved +* 2020-09-24, `v1.6.7`: stable release 1.6: using standard C atomics, passing tsan testing, improved handling of failing to commit on Windows, add [`mi_process_info`](https://github.com/microsoft/mimalloc/blob/master/include/mimalloc.h#L156) api call. * 2020-08-06, `v1.6.4`: stable release 1.6: improved error recovery in low-memory situations, support for IllumOS and Haiku, NUMA support for Vista/XP, improved NUMA detection for AMD Ryzen, ubsan support.