aspose file tools*
The moose likes Performance and the fly likes OutOfMemoryError : Suggestions for debugging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "OutOfMemoryError : Suggestions for debugging" Watch "OutOfMemoryError : Suggestions for debugging" New topic
Author

OutOfMemoryError : Suggestions for debugging

Priyanka Dandekar
Ranch Hand

Joined: Aug 06, 2008
Posts: 52
I am trying to debug an OutOfMemoryError we are getting on Web application which is based on Spring Web flow + Hibernate + c3p0 connection pool.

I am using Jmeter to simulate the load of 5 concurrent users on this system and withing 5 minutes the applications runs out of memory with below message.

java.lang.OutOfMemoryError: Java heap space
Exception in thread "http-8080-3" java.lang.OutOfMemoryError: Java heap space


The applications is not doing much processing so I assume so much memory is not required for it.

I am using JProfiler to do application profiling, but I am kind of new to it so may be any suggestions on a good profiling tool are also welcome.

Looking at the object allocations I see there are too many objects of java.util.concurrent.ConcurrentHashMap and its inner classes. See the attached image with JProfiler report.


Let me know what could be the possible reason for this. I am open to any ideas you have.


On Production we are running this application with 1.5GB JAva Heap space and it runs out of memory within 2-3 days.



[Thumbnail for profiling.JPG]


Priya - Mockup Tool | Java | Struts2 | Lucene
rajesh bala
Ranch Hand

Joined: Jan 14, 2003
Posts: 66
Can you post what is the heap size you used in your server?

Definitely concurrenthashmap came up at top. But looking at the size it occupies, it doesn't seem to be a major issue.

~Rajesh.B
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8968
    
    9

Here is an article on memory leaks, their causes and how to resolve them.

[How To Ask Questions On JavaRanch]
Priyanka Dandekar
Ranch Hand

Joined: Aug 06, 2008
Posts: 52
Thanks for your replies, I figured out the issue. There was a place where a call to findAll method was made on a hibernate entity. This was bringing whole database in memory and we were running out.

I have removed this piece and it works now.

Thanks again for your responses.
Priyanka Dandekar
Ranch Hand

Joined: Aug 06, 2008
Posts: 52
for benefit of others, here are the consolidated list of commands which can help you debug similar issue

Debugging java OutOfMemory issue
 
wood burning stoves
 
subject: OutOfMemoryError : Suggestions for debugging