by PaulHoule · 8y ago · 0 comments
It was particularly strange to set a breakpoint at the beginning of main() with gdb and see the program never got there. Oddly enough, he never actually used the 8GB array, even though he had no problem allocating the array on the POWER workstation he was using.
That’s why it worked on his machine. It didn’t work on yours because of the lack of address space.
Not if you tell it not to. This is a common configuration on servers and other applications where requiring overcommit to function is considered a bug.
(There are some surprising exceptions such as PIC hardware stacks where you might be allowed exactly 8 call frames, and your whole program's call stack must be a DAG with no recursion)
Even if that weren't true, the only way overcommit ever helps is if you don't initialize or otherwise touch the memory you allocate.
I'm not sure what happens if you try to write zeroes in overcommit allocated memory, but I would bet it breaks because it'll pagefault and linux will allocate it.