-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
60 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/src/os.c b/src/os.c | ||
index f33cfbc..536269e 100644 | ||
--- a/src/os.c | ||
+++ b/src/os.c | ||
@@ -405,7 +405,8 @@ static void* mi_unix_mmap(void* addr, size_t size, size_t try_alignment, int pro | ||
|
||
// On 64-bit systems, we can do efficient aligned allocation by using | ||
// the 4TiB to 30TiB area to allocate them. | ||
-#if (MI_INTPTR_SIZE >= 8) && (defined(_WIN32) || (defined(MI_OS_USE_MMAP) && !defined(MAP_ALIGNED))) | ||
+// #if (MI_INTPTR_SIZE >= 8) && (defined(_WIN32) || (defined(MI_OS_USE_MMAP) && !defined(MAP_ALIGNED))) | ||
+#if 0 | ||
static volatile mi_decl_cache_align _Atomic(uintptr_t) aligned_base; | ||
|
||
// Return a 4MiB aligned address that is probably available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
include(ExternalProject) | ||
|
||
set(MIMALLOC_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/mimalloc/install) | ||
|
||
ExternalProject_Add( | ||
mimalloc | ||
PREFIX mimalloc | ||
GIT_REPOSITORY https://github.com/microsoft/mimalloc.git | ||
GIT_TAG v1.6.3 | ||
INSTALL_DIR ${MIMALLOC_INSTALL_DIR} | ||
# We need to patch mimalloc's default mmap ranges as they interfere with | ||
# sanitizers | ||
# https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h#L67-L72 | ||
PATCH_COMMAND | ||
patch -p1 < | ||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/mimalloc-sanitizer-compatibility.patch | ||
UPDATE_COMMAND "" | ||
CMAKE_ARGS | ||
"-DCMAKE_INSTALL_PREFIX=${MIMALLOC_INSTALL_DIR};-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE};-DMI_LOCAL_DYNAMIC_TLS=ON;" | ||
) | ||
|
||
set(IS_DEBUG "") | ||
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) | ||
if(CMAKE_BUILD_TYPE_LC STREQUAL "debug") | ||
set(IS_DEBUG "-debug") | ||
endif() | ||
|
||
find_package(Threads REQUIRED) | ||
add_library(mimalloc-static STATIC IMPORTED GLOBAL) | ||
add_dependencies(mimalloc-static mimalloc) | ||
set_target_properties( | ||
mimalloc-static | ||
PROPERTIES IMPORTED_LOCATION | ||
${MIMALLOC_INSTALL_DIR}/lib/mimalloc-1.6/libmimalloc${IS_DEBUG}.a | ||
INTERFACE_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters