Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OutOfMemoryError : Suggestions for debugging

 
Priyanka Dandekar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
profiling.JPG
[Thumbnail for profiling.JPG]
JProfiler output snapshot for all objects
 
rajesh bala
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9298
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is an article on memory leaks, their causes and how to resolve them.
 
Priyanka Dandekar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for benefit of others, here are the consolidated list of commands which can help you debug similar issue

Debugging java OutOfMemory issue
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic