This particular article isn&#x27;t even about a Java problem. The author is just trying to use more memory than is actually available.<p>If the program is written in C++ instead, what&#x27;d happen is it&#x27;d keep allocating memory beyond the 4 gig limit she imposed on the JVM, until it hit swap and the entire machine bogged down and became slow, or until the kernel OOM killer randomly killed some other (possibly important) program on her desktop to try and make space for it.<p>If she tried to fix that with ulimit, then she&#x27;d get different behaviour - the program would die quickly without slowdown, but before actually using 4 gigabytes of heap, due to fragmentation.<p>In the latest Java release there&#x27;s a flag that makes the JVM exit as soon as there&#x27;s an OutOfMemoryError (or do a heap dump for diagnostics), and there&#x27;s also -XX:+UseGCOverheadLimit which makes the JVM give up sooner if it&#x27;s spending more than 98% of its time garbage collecting (i.e. it&#x27;s reached the limit of its heap but not quite).