5 ms·
From the parent comment: because of OS-level overcommit, which is nearly always a good thing It doesn't matter about the language you are writing in, because
by joosters 9mo ago
From the parent comment:
because of OS-level overcommit, which is nearly always a good thing
It doesn't matter about the language you are writing in, because your OS can tell you that the allocation succeeded, but when you come to use it, only then do you find out that the memory isn't there.
- senko 9mo agoOf course it matters, because you (the system admin) can tell your OS not to do that. Which is only helpful if your app knows how to handle the case. Most don't, so overcommit, in general, makes sense.
- deleted 9mo ago[deleted]
- gpm 9mo agoYou can't really on linux. There's no way to do sparse allocations then because when you turn off overcommit MAP_NORESERVE still reserves memory... It's a place where windows legitimately is better than linux.
- lelanthran 9mo ago> You can't really on linux. There's no way to do sparse allocations then because when you turn off overcommit MAP_NORESERVE still reserves memory... Sure, but ... what does that have to do with this thread? Using `mmap` is not the same as using `malloc` and friends. If you turn off overcommit, malloc will return NULL on failure to allocate. If you specifically request mmap to ignore overcommit, and it does, why are you surprised?
- gpm 8mo ago> If you specifically request mmap to ignore overcommit, and it does, why are you surprised? You misunderstand, you specifically request mmap to ignore overcommit, and it doesn't, not does. What it has to do with this thread is it makes turning off overcommit on linux an exceptionally unpalatable option because it makes a lot of correct software incorrect in an unfixable manner.