How to avoid OutOfMemoryError in java
java.lang.OutOfMemoryError is the one of the error which is not a Exception and it comes under the list of Error in java.
What is OutOfMemoryError?
OutOfMemoryError is common when out of memory in heap. It normally comes when a object is tried to allocate a space if it ran out of heap space OutOfMemoryError Error occurs.
Types of OutOfMemoryError:
- OutOfMemoryError:- java heap space
- OutOfMemoryError:- PermGen space
How To solve or avoid OutOfMemoryError java heap space:
- Normal way to solve this one is JVM options "-Xmx512M"
- example to increase the heap size of JVM is ,its better to keep -Xmx to -Xms ration either 1:1 or 1:1.5 if you are setting heap size in your java application
export JVM_ARGS="-Xms1024m -Xmx1024m" - Next is use the Eclipse Memory Analyzer.
No comments:
Post a Comment