On systems with overcommit (for example, Linux in the default configuration), even for objects with static storage durations, runtime failures can occur. When the program starts, these objects will exist either with zero pages with copy to write (if they were not initialized), or with copy-to-write mappings of the executable file to disk. The first time you try to write them, a page error will occur, and the kernel will make a local, modifiable copy for your process. If the kernel was careless and did not reserve as much memory as was fixed in this process, this may fail, and the result will be a terrible OOM-killer.
No reliable system has this problem, and Linux behavior can be fixed:
echo "2" > /proc/sys/vm/overcommit_memory
source share