Also reminds me that I really would like to find a way that PG can detect allocation failures without requiring memory overcommit to be turned off globally. Just causes too many other programs to misbehave, and is a complicated explicit configuration.https://twitter.com/AndresFreundTec/status/1225559052475871233 …
"Hey I know what to do when malloc returns NULL, thanks" - that's not why this happens. The issue is that most programs allocate more memory than they use, so if you only give out as much memory as if every program used all memory, you fail too early.
-
-
So linux (many other OSs do similarly) just doesn't count unused but allocated memory, unless you enable strict memory accounting. But when you then access the memory (by just dereferencing a pointer) and there is no actual free memory left, there is nothing to return NULL to.
-
So if they can't make space, they have to just kill that, or some other program. The reason for telling you that, is that it's not clear what turning overcommitting off "per application" would precisely mean. Memory is a global resource after all.
- 3 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.