mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-02 13:49:31 +03:00
use consistent naming on Windows vs other platforms. Use mimalloc.dll.lib for the dll import library to avoid a clash with the static mimalloc.lib library
This commit is contained in:
parent
600ca88e87
commit
4fcf56af2e
7 changed files with 61 additions and 53 deletions
|
@ -493,19 +493,19 @@ else()
|
|||
set(mi_install_cmakedir "${CMAKE_INSTALL_LIBDIR}/cmake/mimalloc-${mi_version}") # for cmake package info
|
||||
endif()
|
||||
|
||||
set(mi_basename "mimalloc")
|
||||
set(mi_libname "mimalloc")
|
||||
if(MI_SECURE)
|
||||
set(mi_basename "${mi_basename}-secure")
|
||||
set(mi_libname "${mi_libname}-secure")
|
||||
endif()
|
||||
if(MI_TRACK_VALGRIND)
|
||||
set(mi_basename "${mi_basename}-valgrind")
|
||||
set(mi_libname "${mi_libname}-valgrind")
|
||||
endif()
|
||||
if(MI_TRACK_ASAN)
|
||||
set(mi_basename "${mi_basename}-asan")
|
||||
set(mi_libname "${mi_libname}-asan")
|
||||
endif()
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC)
|
||||
if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$"))
|
||||
set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version
|
||||
set(mi_libname "${mi_libname}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version
|
||||
endif()
|
||||
|
||||
if(MI_BUILD_SHARED)
|
||||
|
@ -522,7 +522,7 @@ if(MI_BUILD_TESTS)
|
|||
endif()
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "Library base name: ${mi_basename}")
|
||||
message(STATUS "Library name : ${mi_libname}")
|
||||
message(STATUS "Version : ${mi_version}.${mi_version_patch}")
|
||||
message(STATUS "Build type : ${CMAKE_BUILD_TYPE_LC}")
|
||||
if(MI_USE_CXX)
|
||||
|
@ -543,7 +543,7 @@ message(STATUS "")
|
|||
# shared library
|
||||
if(MI_BUILD_SHARED)
|
||||
add_library(mimalloc SHARED ${mi_sources})
|
||||
set_target_properties(mimalloc PROPERTIES VERSION ${mi_version} SOVERSION ${mi_version_major} OUTPUT_NAME ${mi_basename} )
|
||||
set_target_properties(mimalloc PROPERTIES VERSION ${mi_version} SOVERSION ${mi_version_major} OUTPUT_NAME ${mi_libname} )
|
||||
target_compile_definitions(mimalloc PRIVATE ${mi_defines} MI_SHARED_LIB MI_SHARED_LIB_EXPORT)
|
||||
target_compile_options(mimalloc PRIVATE ${mi_cflags} ${mi_cflags_dynamic})
|
||||
target_link_libraries(mimalloc PRIVATE ${mi_libraries})
|
||||
|
@ -551,6 +551,15 @@ if(MI_BUILD_SHARED)
|
|||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${mi_install_incdir}>
|
||||
)
|
||||
install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
|
||||
|
||||
if(WIN32)
|
||||
# On windows, the import library name for the dll would clash with the static mimalloc.lib
|
||||
# so we postfix the dll import library with `.dll.lib`.
|
||||
set_property(TARGET mimalloc PROPERTY ARCHIVE_OUTPUT_NAME "${mi_libname}.dll" )
|
||||
install(FILES "$<TARGET_FILE_DIR:mimalloc>/${mi_libname}.dll.lib" DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
if(WIN32 AND MI_WIN_REDIRECT)
|
||||
# On windows, link and copy the mimalloc redirection dll too.
|
||||
if(CMAKE_GENERATOR_PLATFORM STREQUAL "arm64ec")
|
||||
|
@ -558,8 +567,8 @@ if(MI_BUILD_SHARED)
|
|||
elseif(MI_ARCH STREQUAL "x64")
|
||||
set(MIMALLOC_REDIRECT_SUFFIX "")
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
|
||||
message(STATUS "Note: x64 code emulated on Windows for arm64 should use an arm64ec build of 'mimalloc-override.dll'")
|
||||
message(STATUS " with 'mimalloc-redirect-arm64ec.dll'. See the 'bin\\readme.md' for more information.")
|
||||
message(STATUS "Note: x64 code emulated on Windows for arm64 should use an arm64ec build of 'mimalloc.dll'")
|
||||
message(STATUS " together with 'mimalloc-redirect-arm64ec.dll'. See the 'bin\\readme.md' for more information.")
|
||||
endif()
|
||||
elseif(MI_ARCH STREQUAL "x86")
|
||||
set(MIMALLOC_REDIRECT_SUFFIX "32")
|
||||
|
@ -567,28 +576,19 @@ if(MI_BUILD_SHARED)
|
|||
set(MIMALLOC_REDIRECT_SUFFIX "-${MI_ARCH}") # -arm64 etc.
|
||||
endif()
|
||||
|
||||
target_link_libraries(mimalloc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.lib)
|
||||
target_link_libraries(mimalloc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.lib) # the DLL import library
|
||||
add_custom_command(TARGET mimalloc POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" $<TARGET_FILE_DIR:mimalloc>
|
||||
COMMENT "Copy mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll to output directory")
|
||||
install(FILES "$<TARGET_FILE_DIR:mimalloc>/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
||||
install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
|
||||
endif()
|
||||
|
||||
|
||||
# static library
|
||||
if (MI_BUILD_STATIC)
|
||||
if(WIN32)
|
||||
# When building both static and shared libraries on Windows, a static library should use a
|
||||
# different output name to avoid the conflict with the import library of a shared one.
|
||||
string(REPLACE "mimalloc" "mimalloc-static" mi_static_libname ${mi_basename})
|
||||
else()
|
||||
set(mi_static_libname "${mi_basename}")
|
||||
endif()
|
||||
add_library(mimalloc-static STATIC ${mi_sources})
|
||||
set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_static_libname})
|
||||
set_property(TARGET mimalloc-static PROPERTY OUTPUT_NAME ${mi_libname})
|
||||
set_property(TARGET mimalloc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
target_compile_definitions(mimalloc-static PRIVATE ${mi_defines} MI_STATIC_LIB)
|
||||
target_compile_options(mimalloc-static PRIVATE ${mi_cflags} ${mi_cflags_static})
|
||||
|
@ -621,12 +621,15 @@ if (MI_BUILD_OBJECT)
|
|||
)
|
||||
|
||||
# Copy the generated object file (`static.o`) to the output directory (as `mimalloc.o`)
|
||||
if(NOT WIN32)
|
||||
if(WIN32)
|
||||
set(mimalloc-obj-static "${CMAKE_CURRENT_BINARY_DIR}/mimalloc-obj.dir/$<CONFIG>/static${CMAKE_C_OUTPUT_EXTENSION}")
|
||||
else()
|
||||
set(mimalloc-obj-static "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/mimalloc-obj.dir/src/static.c${CMAKE_C_OUTPUT_EXTENSION}")
|
||||
set(mimalloc-obj-out "${CMAKE_CURRENT_BINARY_DIR}/${mi_basename}${CMAKE_C_OUTPUT_EXTENSION}")
|
||||
add_custom_command(OUTPUT ${mimalloc-obj-out} DEPENDS mimalloc-obj COMMAND "${CMAKE_COMMAND}" -E copy "${mimalloc-obj-static}" "${mimalloc-obj-out}")
|
||||
add_custom_target(mimalloc-obj-target ALL DEPENDS ${mimalloc-obj-out})
|
||||
endif()
|
||||
set(mimalloc-obj-out "${CMAKE_CURRENT_BINARY_DIR}/${mi_libname}${CMAKE_C_OUTPUT_EXTENSION}")
|
||||
add_custom_command(OUTPUT ${mimalloc-obj-out} DEPENDS mimalloc-obj COMMAND "${CMAKE_COMMAND}" -E copy "${mimalloc-obj-static}" "${mimalloc-obj-out}")
|
||||
add_custom_target(mimalloc-obj-target ALL DEPENDS ${mimalloc-obj-out})
|
||||
|
||||
|
||||
# the following seems to lead to cmake warnings/errors on some systems, disable for now :-(
|
||||
# install(TARGETS mimalloc-obj EXPORT mimalloc DESTINATION ${mi_install_objdir})
|
||||
|
@ -635,9 +638,10 @@ if (MI_BUILD_OBJECT)
|
|||
# but that fails cmake versions less than 3.10 so we leave it as is for now
|
||||
install(FILES ${mimalloc-obj-static}
|
||||
DESTINATION ${mi_install_objdir}
|
||||
RENAME ${mi_basename}${CMAKE_C_OUTPUT_EXTENSION} )
|
||||
RENAME ${mi_libname}${CMAKE_C_OUTPUT_EXTENSION} )
|
||||
endif()
|
||||
|
||||
|
||||
# pkg-config file support
|
||||
set(mi_pc_libraries "")
|
||||
foreach(item IN LISTS mi_libraries)
|
||||
|
@ -648,12 +652,6 @@ foreach(item IN LISTS mi_libraries)
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
if(MI_BUILD_STATIC) # prefer static linking with pkg-config
|
||||
set(mi_pc_libname "${mi_static_libname}")
|
||||
else()
|
||||
set(mi_pc_libname "${mi_basename}")
|
||||
endif()
|
||||
|
||||
include("cmake/JoinPaths.cmake")
|
||||
join_paths(mi_pc_includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
join_paths(mi_pc_libdir "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||
|
|
|
@ -120,49 +120,49 @@
|
|||
<OutDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
<TargetName>mimalloc-static</TargetName>
|
||||
<TargetName>mimalloc</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
<TargetName>mimalloc-static</TargetName>
|
||||
<TargetName>mimalloc</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
<TargetName>mimalloc-static</TargetName>
|
||||
<TargetName>mimalloc</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<OutDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
<TargetName>mimalloc-static</TargetName>
|
||||
<TargetName>mimalloc</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">
|
||||
<OutDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
<TargetName>mimalloc-static</TargetName>
|
||||
<TargetName>mimalloc</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
<TargetName>mimalloc-static</TargetName>
|
||||
<TargetName>mimalloc</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<OutDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
<TargetName>mimalloc-static</TargetName>
|
||||
<TargetName>mimalloc</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64EC'">
|
||||
<OutDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
<TargetName>mimalloc-static</TargetName>
|
||||
<TargetName>mimalloc</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
|
|
@ -180,6 +180,7 @@
|
|||
</ModuleDefinitionFile>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ImportLibrary>$(OutDir)$(TargetName).dll.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>COPY /Y "$(ProjectDir)..\..\bin\mimalloc-redirect32.dll" "$(OutputPath)"</Command>
|
||||
|
@ -208,6 +209,7 @@
|
|||
</ModuleDefinitionFile>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ImportLibrary>$(OutDir)$(TargetName).dll.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>COPY /Y "$(ProjectDir)..\..\bin\mimalloc-redirect.dll" "$(OutputPath)"</Command>
|
||||
|
@ -236,6 +238,7 @@
|
|||
</ModuleDefinitionFile>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ImportLibrary>$(OutDir)$(TargetName).dll.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>COPY /Y "$(ProjectDir)..\..\bin\mimalloc-redirect-arm64.dll" "$(OutputPath)"</Command>
|
||||
|
@ -264,6 +267,7 @@
|
|||
</ModuleDefinitionFile>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ImportLibrary>$(OutDir)$(TargetName).dll.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>COPY /Y "$(ProjectDir)..\..\bin\mimalloc-redirect-arm64ec.dll" "$(OutputPath)"</Command>
|
||||
|
@ -296,6 +300,7 @@
|
|||
</ModuleDefinitionFile>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ImportLibrary>$(OutDir)$(TargetName).dll.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>COPY /Y "$(ProjectDir)..\..\bin\mimalloc-redirect32.dll" "$(OutputPath)"</Command>
|
||||
|
@ -328,6 +333,7 @@
|
|||
</ModuleDefinitionFile>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ImportLibrary>$(OutDir)$(TargetName).dll.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>COPY /Y "$(ProjectDir)..\..\bin\mimalloc-redirect.dll" "$(OutputPath)"</Command>
|
||||
|
@ -361,6 +367,7 @@
|
|||
</ModuleDefinitionFile>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ImportLibrary>$(OutDir)$(TargetName).dll.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>COPY /Y "$(ProjectDir)..\..\bin\mimalloc-redirect-arm64.dll" "$(OutputPath)"</Command>
|
||||
|
@ -394,6 +401,7 @@
|
|||
</ModuleDefinitionFile>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ImportLibrary>$(OutDir)$(TargetName).dll.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>COPY /Y "$(ProjectDir)..\..\bin\mimalloc-redirect-arm64ec.dll" "$(OutputPath)"</Command>
|
||||
|
|
|
@ -6,6 +6,6 @@ Name: @PROJECT_NAME@
|
|||
Description: A compact general purpose allocator with excellent performance
|
||||
Version: @PACKAGE_VERSION@
|
||||
URL: https://github.com/microsoft/mimalloc/
|
||||
Libs: -L${libdir} -l@mi_pc_libname@
|
||||
Libs: -L${libdir} -l@mi_libname@
|
||||
Libs.private: @mi_pc_libraries@
|
||||
Cflags: -I${includedir}
|
||||
|
|
|
@ -127,7 +127,7 @@ void _mi_prim_mem_init( mi_os_mem_config_t* config )
|
|||
ULONGLONG memInKiB = 0;
|
||||
if (GetPhysicallyInstalledSystemMemory(&memInKiB)) {
|
||||
if (memInKiB > 0 && memInKiB < (SIZE_MAX / MI_KiB)) {
|
||||
config->physical_memory = memInKiB * MI_KiB;
|
||||
config->physical_memory = (size_t)memInKiB * MI_KiB;
|
||||
}
|
||||
}
|
||||
// get the VirtualAlloc2 function
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
project(mimalloc-test C CXX)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
@ -16,7 +16,7 @@ if (NOT CMAKE_BUILD_TYPE)
|
|||
endif()
|
||||
|
||||
# Import mimalloc (if installed)
|
||||
find_package(mimalloc 1.7 REQUIRED NO_SYSTEM_ENVIRONMENT_PATH)
|
||||
find_package(mimalloc 1.9 CONFIG REQUIRED)
|
||||
message(STATUS "Found mimalloc installed at: ${MIMALLOC_LIBRARY_DIR} (${MIMALLOC_VERSION_DIR})")
|
||||
|
||||
# overriding with a dynamic library
|
||||
|
@ -29,9 +29,9 @@ target_link_libraries(dynamic-override-cxx PUBLIC mimalloc)
|
|||
|
||||
# overriding with a static object file works reliable as the symbols in the
|
||||
# object file have priority over those in library files
|
||||
add_executable(static-override-obj main-override.c ${MIMALLOC_OBJECT_DIR}/mimalloc.o)
|
||||
add_executable(static-override-obj main-override.c ${MIMALLOC_OBJECT_DIR}/mimalloc${CMAKE_C_OUTPUT_EXTENSION})
|
||||
target_include_directories(static-override-obj PUBLIC ${MIMALLOC_INCLUDE_DIR})
|
||||
target_link_libraries(static-override-obj PUBLIC pthread)
|
||||
target_link_libraries(static-override-obj PUBLIC mimalloc-static)
|
||||
|
||||
|
||||
# overriding with a static library works too if using the `mimalloc-override.h`
|
||||
|
|
|
@ -37,9 +37,9 @@ static void test_thread_local(); // issue #944
|
|||
static void test_mixed1(); // issue #942
|
||||
static void test_stl_allocators();
|
||||
|
||||
#if _WIN32
|
||||
#if x_WIN32
|
||||
#include "main-override-dep.h"
|
||||
static void test_dep(); // issue #981: test overriding in another DLL
|
||||
static void test_dep(); // issue #981: test overriding in another DLL
|
||||
#else
|
||||
static void test_dep() { };
|
||||
#endif
|
||||
|
@ -50,7 +50,7 @@ int main() {
|
|||
test_mixed1();
|
||||
|
||||
test_dep();
|
||||
|
||||
|
||||
//test_std_string();
|
||||
//test_thread_local();
|
||||
// heap_thread_free_huge();
|
||||
|
@ -59,7 +59,7 @@ int main() {
|
|||
heap_no_delete();
|
||||
heap_late_free();
|
||||
padding_shrink();
|
||||
|
||||
|
||||
tsan_numa_test();
|
||||
*/
|
||||
/*
|
||||
|
@ -112,8 +112,10 @@ static void various_tests() {
|
|||
t->~Test();
|
||||
delete[] tbuf;
|
||||
|
||||
#if _WIN32
|
||||
const char* ptr = ::_Getdays(); // test _base overrid
|
||||
free((void*)ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
class Static {
|
||||
|
@ -143,7 +145,7 @@ static bool test_stl_allocator1() {
|
|||
struct some_struct { int i; int j; double z; };
|
||||
|
||||
|
||||
#if _WIN32
|
||||
#if x_WIN32
|
||||
static void test_dep()
|
||||
{
|
||||
TestAllocInDll t;
|
||||
|
@ -236,7 +238,7 @@ static void test_mixed0() {
|
|||
std::cout << "Running on " << threads.size() << " threads took " << duration
|
||||
<< std::endl;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void asd() {
|
||||
void* p = malloc(128);
|
||||
|
@ -401,7 +403,7 @@ static void test_mt_shutdown()
|
|||
|
||||
// issue #372
|
||||
static void fail_aslr() {
|
||||
size_t sz = (4ULL << 40); // 4TiB
|
||||
size_t sz = (size_t)(4ULL << 40); // 4TiB
|
||||
void* p = malloc(sz);
|
||||
printf("pointer p: %p: area up to %p\n", p, (uint8_t*)p + sz);
|
||||
*(int*)0x5FFFFFFF000 = 0; // should segfault
|
||||
|
|
Loading…
Add table
Reference in a new issue