Enable overcommit for heuristic on Linux

This commit is contained in:
Matthew Parkinson
2021-06-07 09:21:22 +01:00
committed by Matthew Parkinson
parent 9e88691ce6
commit 0757762083

View File

@@ -28,6 +28,14 @@ namespace snmalloc
static constexpr size_t page_size =
Aal::aal_name == PowerPC ? 0x10000 : PALPOSIX::page_size;
/**
* Linux requires an explicit no-reserve flag in `mmap` to guarantee lazy
* commit if /proc/sys/vm/overcommit_memory is set to `heuristic` (0).
*
* https://www.kernel.org/doc/html/latest/vm/overcommit-accounting.html
*/
static constexpr int default_mmap_flags = MAP_NORESERVE;
/**
* OS specific function for zeroing memory.
*