Often, I found OutOfMemoryException on IBM Websphere Application Server. I think this exception occur because my application retrieve Huge data from database. So, I limit all query don’t retreive data more than 1000 records and set JVM of WAS follow
+ Verbose garbage collection + Maximum Heap size = 1024 (RAM on my server is 16 GB and now I already change to 8192) + Debug arguments = -Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777 + Generic JVM arguments = -Dsun.rmi.dgc.server.gcInterval=60000 -Dsun.rmi.dgc.client.gcInterval=60000 -Xdisableexplicitgc -Dws.log=E:\WebApp\log -Dws.log.level=debug (ws.log and ws.log.level are my properties)
And I found heapdump, javacore and snap files in profiles folder I think them can tell me about cause of problem but I don’t know how to read/use heapdump, javacore and snap files.
Please tell me how to prevent/avoid/fix OutOfMemoryException. Thanks
The answer to this is dependent on the message associated with the OutOfMemoryException. You can also try -XX:MaxPermSize=… and set it to something larger like 256m.
Also, if you have a recursive function somewhere, that may be causing a stack overflow.
If you can, please post the message associated with the exception. Stacktrace might also help.