This content has been marked as final. Show 3 replies
Hi Rra,1 person found this helpful
First of all Java has in built mechanism of garbage collection which clears the memory as and when required.
It seems that there might be memory leak in your code due to which memory is not cleared as the objects might still be showing as referenced objects due to which u r noticing OutOfMemory
Also check what kind of OutOfMemory u r noticing in the logs.
You could capture heap dump of the JVM process and analyze it in order to find out the code which is leaking out.
Please go thru the below links :
Also once u restart the servers memory gets cleaned up and is available for use.
Edited by: b!p2!|\| on Jan 4, 2013 3:59 AM
Ya , I know GC is mechanism for clearing the memory. So, you mean if our code is leaking proof, we are never going to get OutOfMemory. But what about slowness of server responding after
handling several requests. When it slows down very much, we have to restart WLS. Is it possible to avoid restarting wls ?
At the very first step your code should be leak proof.
In order to verify that the code is leak proof capture GC logs and check whether after every garbage collection cycle memory is released for reuse , if not there is definitely leak in the code.
You could use GC viewer tool for viewing GC logs, heap dump would definitely give a larger picture with lot of more information and the code which is creating highest number of objects.
First of all it is very necessary to determine how much memory your application would need and accordingly assign enough memory i.e. heap size.
GC plays an important role on how the server behaves so try to tune the GC algorithm for better performance.
Below link speaks about the performance tuning of JVM , however the code should be leak proof.