-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Help with Suspected Memory Leak
PostPosted: Wed Jan 20, 2010 1:30 pm 
Newbie

Joined: Fri Jul 10, 2009 12:15 pm
Posts: 6
Hi All, we are new to Hibernate, and we are experiencing a memory leak in our application, which seems to be related to our use of Hibernate. I'm sure were probably doing something wrong, but not sure what. Can anyone provide some help? I can provide any other info needed?

Our max heap is currently only set to 256, we only have about 25 users.
We are using Websphere App Server 6.1, and Hibernate 3.2.6.ga

IBM Memory Analyzer provides the following message:
One instance of "org.hibernate.context.JTASessionContext" loaded by "com.ibm.ws.classloader.CompoundClassLoader @ 0x700000002709ca8" occupies 96,990,016 (63.57%) bytes. The memory is accumulated in one instance of "java.util.Hashtable$Entry[]" loaded by "com.ibm.oti.vm.BootstrapClassLoader @ 0x70000000000d238".Keywords
java.util.Hashtable$Entry[]
com.ibm.oti.vm.BootstrapClassLoader @ 0x70000000000d238
org.hibernate.context.JTASessionContext
com.ibm.ws.classloader.CompoundClassLoader @ 0x700000002709ca8


Top
 Profile  
 
 Post subject: Re: Help with Suspected Memory Leak
PostPosted: Thu Jan 21, 2010 3:41 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hi,

a common scenario for such memory problem is when using 'extended sessions' for conversations
(= after commit, use the same session for the next transaction) without ever calling clear().
Sometimes hibernate users are not aware that a commit itself don't detaches the objects of the persistent context.
When you never call session.close() or session.clear() then your persistent context will hard reference all persistent
objects you accessed since the first transaction.

Beside this, by my experience a very good tool to analyze memory leaks, is the SAP memory analyzer (it's free).


Top
 Profile  
 
 Post subject: Re: Help with Suspected Memory Leak
PostPosted: Thu Jan 21, 2010 11:17 am 
Newbie

Joined: Fri Jul 10, 2009 12:15 pm
Posts: 6
Thanks pb00067, That makes sense.
We actually never call close() or clear(). We get our session from getCurrentSession(), which we thought handled this. But we are also not using transactions (db is an as400 without the support for transactions....journalling not started)
So after a little more research, it seems that the current session will only be cleared after a commit or rollback, but that never happens, I guess we'll need to account for it.

Thanks again.
Kevin...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.