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.
One possible consequence of a larger heap is an increase in GC times - the JVM has to analyse a larger space, so it takes longer - particularly if its a stop-the-world GC.
Can you flesh out your question a little?
What heap size are you using? What durations are you seeing? Whats the usage pattern of objects in your application? A few long lived objects, or lots of short lived ones, for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With