mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 23:39:31 +03:00
merge from dev
This commit is contained in:
commit
a763b6310d
1 changed files with 2 additions and 2 deletions
4
src/os.c
4
src/os.c
|
@ -917,12 +917,12 @@ static bool mi_os_commitx(void* addr, size_t size, bool commit, bool conservativ
|
||||||
if (err != 0) { err = errno; }
|
if (err != 0) { err = errno; }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if defined(MADV_DONTNEED)
|
#if defined(MADV_DONTNEED) && MI_DEBUG == 0 && MI_SECURE == 0
|
||||||
// decommit: use MADV_DONTNEED as it decreases rss immediately (unlike MADV_FREE)
|
// decommit: use MADV_DONTNEED as it decreases rss immediately (unlike MADV_FREE)
|
||||||
// (on the other hand, MADV_FREE would be good enough.. it is just not reflected in the stats :-( )
|
// (on the other hand, MADV_FREE would be good enough.. it is just not reflected in the stats :-( )
|
||||||
err = madvise(start, csize, MADV_DONTNEED);
|
err = madvise(start, csize, MADV_DONTNEED);
|
||||||
#else
|
#else
|
||||||
// decommit: just disable access
|
// decommit: just disable access (also used in debug and secure mode to trap on illegal access)
|
||||||
err = mprotect(start, csize, PROT_NONE);
|
err = mprotect(start, csize, PROT_NONE);
|
||||||
if (err != 0) { err = errno; }
|
if (err != 0) { err = errno; }
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue