Merge branch 'dev' into dev-slice

This commit is contained in:
Daan 2022-02-14 16:16:03 -08:00
commit e91ee4c384
4 changed files with 16 additions and 6 deletions

View file

@ -158,7 +158,7 @@ if(MI_DEBUG_UBSAN)
if(CMAKE_BUILD_TYPE MATCHES "Debug") if(CMAKE_BUILD_TYPE MATCHES "Debug")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Build with undefined-behavior sanitizer (MI_DEBUG_UBSAN=ON)") message(STATUS "Build with undefined-behavior sanitizer (MI_DEBUG_UBSAN=ON)")
list(APPEND mi_cflags -fsanitize=undefined -g) list(APPEND mi_cflags -fsanitize=undefined -g -fno-sanitize-recover=undefined)
list(APPEND CMAKE_EXE_LINKER_FLAGS -fsanitize=undefined) list(APPEND CMAKE_EXE_LINKER_FLAGS -fsanitize=undefined)
if (NOT MI_USE_CXX) if (NOT MI_USE_CXX)
message(STATUS "(switch to use C++ due to MI_DEBUG_UBSAN)") message(STATUS "(switch to use C++ due to MI_DEBUG_UBSAN)")
@ -175,7 +175,7 @@ endif()
if(MI_USE_CXX) if(MI_USE_CXX)
message(STATUS "Use the C++ compiler to compile (MI_USE_CXX=ON)") message(STATUS "Use the C++ compiler to compile (MI_USE_CXX=ON)")
set_source_files_properties(${mi_sources} PROPERTIES LANGUAGE CXX ) set_source_files_properties(${mi_sources} PROPERTIES LANGUAGE CXX )
set_source_files_properties(src/static.c test/test-api.c test/test-stress PROPERTIES LANGUAGE CXX ) set_source_files_properties(src/static.c test/test-api.c test/test-api-fill test/test-stress PROPERTIES LANGUAGE CXX )
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang|Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang|Clang")
list(APPEND mi_cflags -Wno-deprecated) list(APPEND mi_cflags -Wno-deprecated)
endif() endif()

View file

@ -12,8 +12,8 @@ is a general purpose allocator with excellent [performance](#performance) charac
Initially developed by Daan Leijen for the run-time systems of the Initially developed by Daan Leijen for the run-time systems of the
[Koka](https://koka-lang.github.io) and [Lean](https://github.com/leanprover/lean) languages. [Koka](https://koka-lang.github.io) and [Lean](https://github.com/leanprover/lean) languages.
Latest release tag: `v2.0.3` (beta, 2021-11-14). Latest release tag: `v2.0.4` (beta, 2022-02-14).
Latest stable tag: `v1.7.3` (2021-11-14). Latest stable tag: `v1.7.4` (2022-02-14).
mimalloc is a drop-in replacement for `malloc` and can be used in other programs mimalloc 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: without code changes, for example, on dynamically linked ELF-based systems (Linux, BSD, etc.) you can use it as:
@ -77,6 +77,12 @@ Note: the `v2.x` beta has a new algorithm for managing internal mimalloc pages t
and fragmentation compared to mimalloc `v1.x` (especially for large workloads). Should otherwise have similar performance and fragmentation compared to mimalloc `v1.x` (especially for large workloads). Should otherwise have similar performance
(see [below](#performance)); please report if you observe any significant performance regression. (see [below](#performance)); please report if you observe any significant performance regression.
* 2022-02-14, `v1.7.4`, `v2.0.4` (alpha): fix malloc override on
Windows 11, fix compilation with musl, potentially reduced
committed memory, add `bin/minject` for Windows,
improved wasm support, faster aligned allocation,
various small fixes.
* 2021-11-14, `v1.7.3`, `v2.0.3` (beta): improved WASM support, improved macOS support and performance (including * 2021-11-14, `v1.7.3`, `v2.0.3` (beta): improved WASM support, improved macOS support and performance (including
M1), improved performance for v2 for large objects, Python integration improvements, more standard M1), improved performance for v2 for large objects, Python integration improvements, more standard
installation directories, various small fixes. installation directories, various small fixes.

View file

@ -300,7 +300,7 @@ static bool mi_os_mem_free(void* addr, size_t size, bool was_committed, mi_stats
} }
} }
#if !defined(MI_USE_SBRK) && !defined(__wasi__) #if !(defined(__wasi__) || defined(MI_USE_SBRK) || defined(MAP_ALIGNED))
static void* mi_os_get_aligned_hint(size_t try_alignment, size_t size); static void* mi_os_get_aligned_hint(size_t try_alignment, size_t size);
#endif #endif
@ -659,7 +659,7 @@ static void* mi_os_get_aligned_hint(size_t try_alignment, size_t size)
if (hint%try_alignment != 0) return NULL; if (hint%try_alignment != 0) return NULL;
return (void*)hint; return (void*)hint;
} }
#elif defined(__wasi__) || defined(MI_USE_SBRK) #elif defined(__wasi__) || defined(MI_USE_SBRK) || defined(MAP_ALIGNED)
// no need for mi_os_get_aligned_hint // no need for mi_os_get_aligned_hint
#else #else
static void* mi_os_get_aligned_hint(size_t try_alignment, size_t size) { static void* mi_os_get_aligned_hint(size_t try_alignment, size_t size) {

View file

@ -72,6 +72,10 @@ int main(void) {
CHECK_BODY("calloc0",{ CHECK_BODY("calloc0",{
result = (mi_usable_size(mi_calloc(0,1000)) <= 16); result = (mi_usable_size(mi_calloc(0,1000)) <= 16);
}); });
CHECK_BODY("malloc-large",{ // see PR #544.
void* p = mi_malloc(67108872);
mi_free(p);
});
// --------------------------------------------------- // ---------------------------------------------------
// Extended // Extended