Java Error: Java Heap Space

Asked By 0 points N/A Posted on -
qa-featured

Hi to all!

Not exceeding the limit of my hard disk, but very near it, I have increased the initial and maximal heap size to deal with this error. Do I need to add some external memory?

Will this fix the error permanently?

Please share what you think about this error, thanks.

Unexpected Error

An unexpected error occurred. Your data may be inconsistent, and subsequent errors may occur. Java.lang.OutOfMemoryError: Java heap space

SHARE
Answered By 0 points N/A #93984

Java Error: Java Heap Space

qa-featured

Hi Diana,

This kind of error indicates that an object creation failed because there was no available heap space for it.

Here is a solution for that:

  1. Check for memory leaks. – Use the Jconsole memory tab in order to examine the graph of your memory usage of your application overtime.
  2. Increase the heap size. – Use the JVM flags -Xms and -Xms to set the initial and maximal heap size. Make sure that it's not exceeded by the physical memory size, other wise you encourage paging which affects performance. Sometimes, installing additional physical memory is required.
  3. Reconsider the design – An inadequate design can consume too much heap space and cause this OOME. For example, disc/database storage can replace some of the data structures in RAM, and memory sensitive mechanisms such as weak/soft references can be introduced.

Greg

Related Questions