3 ms·
I suggest trying that :) You'd be surprised. glibc allocator, like pretty much any other allocator, maps pages in advance without touching them. It's quite lik
by cyberax 2y ago
I suggest trying that :) You'd be surprised.
glibc allocator, like pretty much any other allocator, maps pages in advance without touching them. It's quite likely that you'll get OOM killed when you first try to touch them, rather than during mmap() for new pages.
- fulafel 2y agoAssuming you've also set overcommit_ratio to a conservative value, this would mean that the kernel overcommit=2 setting is not working, since mmap-ing writable pages counts as allocation from overcommit POV. It's a kernel sysctl, so I wouldn't expect it to change glibc's behaviour. There don't seem to be any open bugs about this in the kernel bugzilla. But do tell if you have found a bug in this area. (This is documented in https://www.kernel.org/doc/html/latest/mm/overcommit-accounting.html https://www.kernel.org/doc/html/latest/mm/overcommit-account... )