As indicated in Understanding JVM Memory Allocation and Java Out of Memory: Heap Space, when heap space is allocated, JVM does not distinguish between physical and virtual memory. When the memory allocation of java objects and computations start happening, JVM starts to distinguish between virtual and physical memory. Given sufficient swap space (on a Linux machine), why does an out of memory error ever occur? Shouldn't the JVM simply use the swap space to complete the computations, albeit very slowly.
Eg: RAM: 14GB, swap space: 10GB
If a java application needs 20GB of space, couldn't it utilize the swap space (virtual memory) and complete running the application?
What is the interplay between heap space and virtual memory with respect to a java application?