diff --git a/src/pal/pal_linux.h b/src/pal/pal_linux.h index f9ad8b2..8104b33 100644 --- a/src/pal/pal_linux.h +++ b/src/pal/pal_linux.h @@ -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. *