3 ms·
If you're running on a regular OS, you can't escape it by just not calling malloc. You'll still get lower performance if the system is low on memory, because y
by astrange 4y ago
If you're running on a regular OS, you can't escape it by just not calling malloc.
You'll still get lower performance if the system is low on memory, because you got swapped out - it doesn't have much if anything to do with how much you allocated. Wiring it is a different story, and if you're an audio app maybe you should allocate and mlock(), but not a database.
> hot take here, programs should stop assuming malloc can return infinite memory anyway.
Assuming this is a perfectly fine way to make reliable software.
https://en.wikipedia.org/wiki/Crash-only_software https://en.wikipedia.org/wiki/Crash-only_software
- jandrewrogers 4y ago> Wiring it is a different story, and if you're an audio app maybe you should allocate and mlock(), but not a database. Why wouldn't you wire database memory?
- astrange 4y agoIf you're the only one on the system then nobody's going to swap you out, so it won't do anything. If you aren't the only one on the system, then you're probably not the most important process. No reason to fight the OS unless you're a hard realtime process, which a database usually isn't.
- jandrewrogers 4y agoMany databases wire their memory because swapping would be operationally catastrophic and they position themselves as being designed for "mission-critical" applications. I've seen databases get swapped a couple times many years ago, it isn't pretty. Databases have a roughly fixed memory footprint, so sensible configurations don't contribute to memory pressure experienced by other processes. Database implementations are capable of swapping most of their address space themselves, independent of and better than the OS -- it is a large part of their function. As such, optimization is heavily dependent on both memory and storage being physical. This being true is precondition for most architectural macro-optimizations to work.