3 ms·
The code in the example asks for a top-level array of length (uint) -1 with all elements initialized to 1. Overcommit would never help, because where this blows
by candiodari 9y ago
The code in the example asks for a top-level array of length (uint) -1 with all elements initialized to 1. Overcommit would never help, because where this blows up is not in running the program, but in compiling it.
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.
- Aaargh20318 9y agoI was of course referring to the example in the post I was replying to. If someone allocates an 8GB array but never uses it, that doesn't do anything. The code you're referring to has that array explicitly set as main.