Hacker News new | ask | show | jobs
by quotemstr 1882 days ago
I don't like it when programs rely on VM overcommit in such a way that they break on other systems. Even if you don't care about Windows (which is a strict accounting no-overcommit system), you should care about Linux, which can be configured to do strict accounting the way Windows does.

If you want to use the big address-space carve-out trick, you can, but the right way to do it is to PROT_NONE the parts of the address space you aren't using and install a signal handler to commit bits of your carveout as they're used.

1 comments

Processing a signal and mapping memory via that signal is less efficient than letting the kernel do it for you.

You'll get better performance by using userfaultfd.

That too, but if you commit in big enough chunks, you amortize the signal handling overhead down to almost nothing.