mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-12 14:18:42 +03:00
wip: use purge throughout for segments and arenas; more agressive delays
This commit is contained in:
parent
94a867869e
commit
f5ab38f87b
10 changed files with 141 additions and 127 deletions
15
src/os.c
15
src/os.c
|
@ -436,6 +436,21 @@ bool _mi_os_unreset(void* addr, size_t size, bool* is_zero, mi_stats_t* tld_stat
|
|||
}
|
||||
*/
|
||||
|
||||
// either resets or decommits memory, returns true if the memory was decommitted.
|
||||
bool _mi_os_purge(void* p, size_t size, mi_stats_t* stats) {
|
||||
if (mi_option_is_enabled(mi_option_purge_decommits) && // should decommit?
|
||||
!_mi_preloading()) // don't decommit during preloading (unsafe)
|
||||
{
|
||||
_mi_os_decommit(p, size, stats);
|
||||
return true; // decommitted
|
||||
}
|
||||
else {
|
||||
_mi_os_reset(p, size, stats);
|
||||
return false; // not decommitted
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Protect a region in memory to be not accessible.
|
||||
static bool mi_os_protectx(void* addr, size_t size, bool protect) {
|
||||
// page align conservatively within the range
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue