I increased the java Xmx memory limit when an exception related to insufficient heap space was thrown. However, I am currently experiencing a very long execution time that may be memory related but I have not seen the exception thrown (yet).
I am wondering what may account for the long execution time. Does the JVM swap the heap to disk?
I’m using HotSpot 1.6.0 update 34.
The JVM does not swap to disk, no. The operating system may do so. You can detect this by checking your OS stats on the process.
As the JVM runs out of memory, garbage collection is triggered more and more frequently. Each run frees less memory, increasing the rate of GC further. Eventually a lot of time is spent in GC, which is likely the slow-down you see.
The JVM doesn’t wait until 0 bytes are freed to throw
OutOfMemoryError. It will actually give up when GC is simply taking too long versus the number of bytes freed.