4 ms·
It is pointless, because in Linux all you get is a virtual address. Physical backing is only allocated on first use. In other words, the first time you access
by david-gpu 8mo ago
It is pointless, because in Linux all you get is a virtual address. Physical backing is only allocated on first use.
In other words, the first time you access a "freshly allocated" non-null pointer you may get a page fault due to insufficient physical memory.
- 3836293648 8mo agoBy default, yes. You can configure it to not overcommit
- david-gpu 8mo agoRight, but as a programmer you rarely have control over that. And even if you do, you often can't handle out of memory errors gracefully. Thus, for a typical situation it is reasonable to log the error and bail out, rather than adding extra custom error handling around every single memory allocation, which ends up being code that is never tested.