This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes memory leak in spring-hibernate application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "memory leak in spring-hibernate application" Watch "memory leak in spring-hibernate application" New topic

memory leak in spring-hibernate application

anuja Kar

Joined: Jun 15, 2010
Posts: 9
I am having a spring hibernate webapplication which runs on jboss server. I have noticed JVM Free memory decreasing drastically in a weeks time since i start the server .
and jvm thread count goes up. I have run heap dump on eclipse memory analyzer and it list -org.hibernate.impl.SessionFactoryImpl as prime suspect . My application connect to three different database and hence having three sessionFactories. I have disabled the cache still the memory analyzer shows object retained by org.hibernate.engine.query.QueryPlanCache . Is there any way to disable this ?

Following are my hibernate properties.

Thanks & Regards
Rishi Shehrawat
Ranch Hand

Joined: Aug 11, 2010
Posts: 218

Try hibernate.cache.use_query_cache false

I feel that probability of this being a issue with Hibernate is on the lower side.

It is also possible that rather than being a memory leak the issue be caused due to large amount of data being loaded by the application. In this case the objects will show up as being referenced by Session Factory even though the application is loading the data.

Have you enabled GC logging? At times the GC logs provide useful information. Are you also taking thread dumps?

I would suggest that you look at the type of entities being held in memory in the heap dump. Then try to co-relate it with the thread dump that you have taken, i:e is any of the threads showing up in thread dump loading this data?
anuja Edathu
Ranch Hand

Joined: Sep 09, 2005
Posts: 84
Thank you for the suggestion. now im tryingto analyse the thread dump.

I agree. Here's the link:
subject: memory leak in spring-hibernate application
It's not a secret anymore!