An OutOfMemory is a condition in which there is not enough space left for allocating required space for the new objects or libraries or native codes.
---------OutOfMemory in Java Heap-----------:
This happens when the JVM is not able to allocate the required memory space for a Java Object. There may be many reasons behind this…like
Point-1) Very Less Heap Size allocation. Means setting the MaxHeapSize (-Xmx) parameter to a very less value.
Point-2) The Leaking of Objects. Either the Application is not unreferencing the unused Objects or the Third part frameworks (Hibernate/Spring/Seam…etc) might not be releasing the references of the objects due to some inaccurate configurations.
Point-3) In Many cases it may be the reason that Application codes are getting the JDBC connections objects from the DataSource are not being released back to the Connection Pool.
Point-4) Garbage Collection strategy may be in correct according to the environmental/application requirements.
Point-5) In-accurate setting of Application/Frameworks Cache.
-----------What to do in case of OutOfMemory In JavaHeap-----------:
Whenever we see an OutOfMemory in the server log or in the stdout of the server. We must try to do the following things as first aid steps:
Point-1) If possible enable the following JAVA_OPTIONS in the server start Scripts to get the informations of the Garbage Collection status.
-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Xloggc:/opt/app/GCLogsDirectory/gc.log
Point-2) It is always needed to see what all objects were present when the OutOfMemory error occured to identify whether those objects belongs to the Application Code/ Application Framework Codes/ The Application Server APIs. Sothat we can isolate the issue. In order to get the details of the Heap Objects collect “HeapDump” either using JHat (not a better tool) or JMap (Much Better compared to the Jhat tool).
Point-3) Once we collected the Heap Dump we can easily monitor the Heap Details using best GUI toold like “Jhat Web Browser” or using “Eclipse Memory Analyzer”.
Thanks to Naga Venkata Prasad.
---------OutOfMemory in Java Heap-----------:
This happens when the JVM is not able to allocate the required memory space for a Java Object. There may be many reasons behind this…like
Point-1) Very Less Heap Size allocation. Means setting the MaxHeapSize (-Xmx) parameter to a very less value.
Point-2) The Leaking of Objects. Either the Application is not unreferencing the unused Objects or the Third part frameworks (Hibernate/Spring/Seam…etc) might not be releasing the references of the objects due to some inaccurate configurations.
Point-3) In Many cases it may be the reason that Application codes are getting the JDBC connections objects from the DataSource are not being released back to the Connection Pool.
Point-4) Garbage Collection strategy may be in correct according to the environmental/application requirements.
Point-5) In-accurate setting of Application/Frameworks Cache.
-----------What to do in case of OutOfMemory In JavaHeap-----------:
Whenever we see an OutOfMemory in the server log or in the stdout of the server. We must try to do the following things as first aid steps:
Point-1) If possible enable the following JAVA_OPTIONS in the server start Scripts to get the informations of the Garbage Collection status.
-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Xloggc:/opt/app/GCLogsDirectory/gc.log
Point-2) It is always needed to see what all objects were present when the OutOfMemory error occured to identify whether those objects belongs to the Application Code/ Application Framework Codes/ The Application Server APIs. Sothat we can isolate the issue. In order to get the details of the Heap Objects collect “HeapDump” either using JHat (not a better tool) or JMap (Much Better compared to the Jhat tool).
Point-3) Once we collected the Heap Dump we can easily monitor the Heap Details using best GUI toold like “Jhat Web Browser” or using “Eclipse Memory Analyzer”.
Thanks to Naga Venkata Prasad.
No comments:
Post a Comment