mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-07 15:59:32 +03:00
merge from dev
This commit is contained in:
commit
84e1f7c92e
5 changed files with 5 additions and 3 deletions
|
@ -211,6 +211,7 @@ endif()
|
||||||
|
|
||||||
# static library
|
# static library
|
||||||
add_library(mimalloc-static STATIC ${mi_sources})
|
add_library(mimalloc-static STATIC ${mi_sources})
|
||||||
|
set_property(TARGET mimalloc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
target_compile_definitions(mimalloc-static PRIVATE ${mi_defines} MI_STATIC_LIB)
|
target_compile_definitions(mimalloc-static PRIVATE ${mi_defines} MI_STATIC_LIB)
|
||||||
target_compile_options(mimalloc-static PRIVATE ${mi_cflags})
|
target_compile_options(mimalloc-static PRIVATE ${mi_cflags})
|
||||||
target_link_libraries(mimalloc-static PUBLIC ${mi_libraries})
|
target_link_libraries(mimalloc-static PUBLIC ${mi_libraries})
|
||||||
|
@ -247,6 +248,7 @@ endif()
|
||||||
|
|
||||||
# single object file for more predictable static overriding
|
# single object file for more predictable static overriding
|
||||||
add_library(mimalloc-obj OBJECT src/static.c)
|
add_library(mimalloc-obj OBJECT src/static.c)
|
||||||
|
set_property(TARGET mimalloc-obj PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
target_compile_definitions(mimalloc-obj PRIVATE ${mi_defines})
|
target_compile_definitions(mimalloc-obj PRIVATE ${mi_defines})
|
||||||
target_compile_options(mimalloc-obj PRIVATE ${mi_cflags})
|
target_compile_options(mimalloc-obj PRIVATE ${mi_cflags})
|
||||||
target_include_directories(mimalloc-obj PUBLIC
|
target_include_directories(mimalloc-obj PUBLIC
|
||||||
|
|
|
@ -103,7 +103,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
void operator delete[](void* p, std::size_t n) noexcept MI_FORWARD02(mi_free_size,p,n);
|
void operator delete[](void* p, std::size_t n) noexcept MI_FORWARD02(mi_free_size,p,n);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (__cplusplus > 201402L || defined(__cpp_aligned_new)) && (!defined(__GNUC__) || (__GNUC__ > 5))
|
#if (__cplusplus > 201402L && defined(__cpp_aligned_new)) && (!defined(__GNUC__) || (__GNUC__ > 5))
|
||||||
void operator delete (void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast<size_t>(al)); }
|
void operator delete (void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast<size_t>(al)); }
|
||||||
void operator delete[](void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast<size_t>(al)); }
|
void operator delete[](void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast<size_t>(al)); }
|
||||||
void operator delete (void* p, std::size_t n, std::align_val_t al) noexcept { mi_free_size_aligned(p, n, static_cast<size_t>(al)); };
|
void operator delete (void* p, std::size_t n, std::align_val_t al) noexcept { mi_free_size_aligned(p, n, static_cast<size_t>(al)); };
|
||||||
|
|
|
@ -393,7 +393,7 @@ void _mi_page_free(mi_page_t* page, mi_page_queue_t* pq, bool force) {
|
||||||
_mi_segment_page_free(page, force, segments_tld);
|
_mi_segment_page_free(page, force, segments_tld);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MI_MAX_RETIRE_SIZE (MI_MEDIUM_OBJ_SIZE_MAX)
|
#define MI_MAX_RETIRE_SIZE MI_LARGE_OBJ_SIZE_MAX
|
||||||
#define MI_RETIRE_CYCLES (8)
|
#define MI_RETIRE_CYCLES (8)
|
||||||
|
|
||||||
// Retire a page with no more used blocks
|
// Retire a page with no more used blocks
|
||||||
|
|
|
@ -205,6 +205,7 @@ static bool mi_region_try_alloc_os(size_t blocks, bool commit, bool allow_large,
|
||||||
|
|
||||||
// and share it
|
// and share it
|
||||||
mi_region_info_t info;
|
mi_region_info_t info;
|
||||||
|
info.value = 0; // initialize the full union to zero
|
||||||
info.x.valid = true;
|
info.x.valid = true;
|
||||||
info.x.is_large = region_large;
|
info.x.is_large = region_large;
|
||||||
info.x.numa_node = (short)_mi_os_numa_node(tld);
|
info.x.numa_node = (short)_mi_os_numa_node(tld);
|
||||||
|
|
|
@ -268,7 +268,6 @@ static void mi_segments_track_size(long segment_size, mi_segments_tld_t* tld) {
|
||||||
if (tld->current_size > tld->peak_size) tld->peak_size = tld->current_size;
|
if (tld->current_size > tld->peak_size) tld->peak_size = tld->current_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void mi_segment_os_free(mi_segment_t* segment, mi_segments_tld_t* tld) {
|
static void mi_segment_os_free(mi_segment_t* segment, mi_segments_tld_t* tld) {
|
||||||
segment->thread_id = 0;
|
segment->thread_id = 0;
|
||||||
mi_segment_map_freed_at(segment);
|
mi_segment_map_freed_at(segment);
|
||||||
|
|
Loading…
Add table
Reference in a new issue