mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-07 15:59:32 +03:00
make lazy commit default; add commit check on segment allocation
This commit is contained in:
parent
1b0de9b4cf
commit
f86519bca6
2 changed files with 4 additions and 3 deletions
|
@ -60,7 +60,7 @@ static mi_option_desc_t options[_mi_option_last] =
|
||||||
{ 0, UNINIT, MI_OPTION(verbose) },
|
{ 0, UNINIT, MI_OPTION(verbose) },
|
||||||
|
|
||||||
// the following options are experimental and not all combinations make sense.
|
// the following options are experimental and not all combinations make sense.
|
||||||
{ 1, UNINIT, MI_OPTION(eager_commit) }, // commit on demand?
|
{ 0, UNINIT, MI_OPTION(eager_commit) }, // commit on demand?
|
||||||
#if defined(_WIN32) || (MI_INTPTR_SIZE <= 4) // and other OS's without overcommit?
|
#if defined(_WIN32) || (MI_INTPTR_SIZE <= 4) // and other OS's without overcommit?
|
||||||
{ 0, UNINIT, MI_OPTION(eager_region_commit) },
|
{ 0, UNINIT, MI_OPTION(eager_region_commit) },
|
||||||
{ 0, UNINIT, MI_OPTION(reset_decommits) }, // reset decommits memory
|
{ 0, UNINIT, MI_OPTION(reset_decommits) }, // reset decommits memory
|
||||||
|
|
|
@ -671,7 +671,8 @@ static mi_segment_t* mi_segment_init(mi_segment_t* segment, size_t required, mi_
|
||||||
if (!commit) {
|
if (!commit) {
|
||||||
// at least commit the info slices
|
// at least commit the info slices
|
||||||
mi_assert_internal(MI_COMMIT_SIZE > info_slices*MI_SEGMENT_SLICE_SIZE);
|
mi_assert_internal(MI_COMMIT_SIZE > info_slices*MI_SEGMENT_SLICE_SIZE);
|
||||||
_mi_os_commit(segment, MI_COMMIT_SIZE, &is_zero, tld->stats);
|
bool ok = _mi_os_commit(segment, MI_COMMIT_SIZE, &is_zero, tld->stats);
|
||||||
|
if (!ok) return NULL; // failed to commit
|
||||||
}
|
}
|
||||||
segment->memid = memid;
|
segment->memid = memid;
|
||||||
segment->mem_is_fixed = mem_large;
|
segment->mem_is_fixed = mem_large;
|
||||||
|
|
Loading…
Add table
Reference in a new issue