mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-08 00:09:31 +03:00
wip: change decommit expiration
This commit is contained in:
parent
ba6b4bf622
commit
c6b82a4b37
3 changed files with 17 additions and 3 deletions
|
@ -176,7 +176,7 @@ endif()
|
||||||
|
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU")
|
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU")
|
||||||
list(APPEND mi_cflags -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden)
|
list(APPEND mi_cflags -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden $<$<CONFIG:RELEASE>:-O3>)
|
||||||
if(NOT MI_USE_CXX)
|
if(NOT MI_USE_CXX)
|
||||||
list(APPEND mi_cflags -Wstrict-prototypes)
|
list(APPEND mi_cflags -Wstrict-prototypes)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -89,7 +89,7 @@ static mi_option_desc_t options[_mi_option_last] =
|
||||||
{ 1, UNINIT, MI_OPTION(eager_commit_delay) }, // the first N segments per thread are not eagerly committed (but per page in the segment on demand)
|
{ 1, UNINIT, MI_OPTION(eager_commit_delay) }, // the first N segments per thread are not eagerly committed (but per page in the segment on demand)
|
||||||
#endif
|
#endif
|
||||||
{ 1, UNINIT, MI_OPTION(allow_decommit) }, // decommit slices when no longer used (after reset_delay milli-seconds)
|
{ 1, UNINIT, MI_OPTION(allow_decommit) }, // decommit slices when no longer used (after reset_delay milli-seconds)
|
||||||
{ 100, UNINIT, MI_OPTION(reset_delay) }, // page reset delay in milli-seconds (= decommit)
|
{ 50, UNINIT, MI_OPTION(reset_delay) }, // page reset delay in milli-seconds (= decommit)
|
||||||
{ 500, UNINIT, MI_OPTION(segment_decommit_delay) },// decommit delay in milli-seconds for freed segments
|
{ 500, UNINIT, MI_OPTION(segment_decommit_delay) },// decommit delay in milli-seconds for freed segments
|
||||||
{ 0, UNINIT, MI_OPTION(use_numa_nodes) }, // 0 = use available numa nodes, otherwise use at most N nodes.
|
{ 0, UNINIT, MI_OPTION(use_numa_nodes) }, // 0 = use available numa nodes, otherwise use at most N nodes.
|
||||||
{ 0, UNINIT, MI_OPTION(limit_os_alloc) }, // 1 = do not use OS memory for allocation (but only reserved arenas)
|
{ 0, UNINIT, MI_OPTION(limit_os_alloc) }, // 1 = do not use OS memory for allocation (but only reserved arenas)
|
||||||
|
|
|
@ -416,7 +416,21 @@ static void mi_segment_perhaps_decommit(mi_segment_t* segment, uint8_t* p, size_
|
||||||
|
|
||||||
// update delayed commit
|
// update delayed commit
|
||||||
mi_commit_mask_set(&segment->decommit_mask, mi_commit_mask_intersect(mask,segment->commit_mask)); // only decommit what is committed; span_free may try to decommit more
|
mi_commit_mask_set(&segment->decommit_mask, mi_commit_mask_intersect(mask,segment->commit_mask)); // only decommit what is committed; span_free may try to decommit more
|
||||||
segment->decommit_expire = _mi_clock_now() + mi_option_get(mi_option_reset_delay);
|
mi_msecs_t now = _mi_clock_now();
|
||||||
|
if (segment->decommit_expire == 0) {
|
||||||
|
// no previous decommits, initialize now
|
||||||
|
mi_assert_internal(mi_commit_mask_is_empty(segment->decommit_mask));
|
||||||
|
segment->decommit_expire = now + mi_option_get(mi_option_reset_delay);
|
||||||
|
}
|
||||||
|
else if (segment->decommit_expire <= now) {
|
||||||
|
// previous decommit mask already expired
|
||||||
|
// mi_segment_delayed_decommit(segment, true, stats);
|
||||||
|
segment->decommit_expire = now + 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// previous decommit mask is not yet expired
|
||||||
|
// segment->decommit_expire++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue