mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 06:59:32 +03:00
fix reset error on windows when disabling eager commit option
This commit is contained in:
parent
b052d3b731
commit
6cf16b1201
2 changed files with 8 additions and 4 deletions
10
src/memory.c
10
src/memory.c
|
@ -461,10 +461,14 @@ void _mi_mem_free(void* p, size_t size, size_t id, mi_stats_t* stats) {
|
||||||
// reset: 10x slowdown on malloc-large, decommit: 17x slowdown on malloc-large
|
// reset: 10x slowdown on malloc-large, decommit: 17x slowdown on malloc-large
|
||||||
if (!is_large) {
|
if (!is_large) {
|
||||||
if (mi_option_is_enabled(mi_option_segment_reset)) {
|
if (mi_option_is_enabled(mi_option_segment_reset)) {
|
||||||
_mi_os_reset(p, size, stats); //
|
if (!is_eager_committed && // cannot reset large pages
|
||||||
// _mi_os_decommit(p,size,stats); // if !is_eager_committed (and clear dirty bits)
|
(mi_option_is_enabled(mi_option_eager_commit) || // cannot reset halfway committed segments, use `option_page_reset` instead
|
||||||
|
mi_option_is_enabled(mi_option_reset_decommits))) // but we can decommit halfway committed segments
|
||||||
|
{
|
||||||
|
_mi_os_reset(p, size, stats);
|
||||||
|
//_mi_os_decommit(p, size, stats); // todo: and clear dirty bits?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// else { _mi_os_reset(p,size,stats); }
|
|
||||||
}
|
}
|
||||||
if (!is_eager_committed) {
|
if (!is_eager_committed) {
|
||||||
// adjust commit statistics as we commit again when re-using the same slot
|
// adjust commit statistics as we commit again when re-using the same slot
|
||||||
|
|
|
@ -65,7 +65,7 @@ static mi_option_desc_t options[_mi_option_last] =
|
||||||
{ 0, UNINIT, MI_OPTION(cache_reset) },
|
{ 0, UNINIT, MI_OPTION(cache_reset) },
|
||||||
{ 0, UNINIT, MI_OPTION(reset_decommits) }, // note: cannot enable this if secure is on
|
{ 0, UNINIT, MI_OPTION(reset_decommits) }, // note: cannot enable this if secure is on
|
||||||
{ 0, UNINIT, MI_OPTION(eager_commit_delay) }, // the first N segments per thread are not eagerly committed
|
{ 0, UNINIT, MI_OPTION(eager_commit_delay) }, // the first N segments per thread are not eagerly committed
|
||||||
{ 0, UNINIT, MI_OPTION(segment_reset) }, // reset segment memory on free
|
{ 0, UNINIT, MI_OPTION(segment_reset) }, // reset segment memory on free (needs eager commit)
|
||||||
{ 100, UNINIT, MI_OPTION(os_tag) } // only apple specific for now but might serve more or less related purpose
|
{ 100, UNINIT, MI_OPTION(os_tag) } // only apple specific for now but might serve more or less related purpose
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue