Monday, January 18, 2010

java.lang.OutOfMemoryError Out of swap space?

I have encountered this error in one of our Hotspot JVMs. Googling for a while without definitive result, I decided to look at source code of Hotspot VM (happily the source code is available in Sun website).
Within few minutes, with very little effort, I found that JVM print out this message when got NULL from calling malloc. So it turns out to find why malloc fails.
When OS does not have RAM to satisfy malloc, it may try to swap out unused real memory to disk and if the swap space is configured too small, the error appears. But this is just one cause.
Other more likely cause is that JVM run out of memory address space and this is our case. It can happen when we run 32 bit JVM and total memory used by the JVM exceeds magical limit of 3 GB (on 32 bit kernel LINUX).

4 comments:

Unknown said...

such a valuable info for me thanks a lot. keep the great stuff.

Personal Injury Lawyer

Jessica said...

Thank you for bringing a well thought out and reasoned comment to the discussion.


Business Law Temecula

claudia said...

thank you for this wonderful post..

awesome health

Anonymous said...

VCS