-->
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.  [ 2 posts ] 
Author Message
 Post subject: Each time Hibernate is re-inited, ~30mb heap are gone
PostPosted: Fri Apr 15, 2011 3:10 pm 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
Hi,

We've developed an Applet using Hibernate which works quite well.

One huge problem however is, each time the applet is re-loaded (and therefor the hibernate is re-initialized) about +30mb of heap are gone.
Users using the default heap-size of 96mb can therefor reload the applet only twice before they encounter OOM.

With -Xmx256M the following loop runs 9 times, before hitting an OOM:
Code:
   for(int i=0; i < 100; i++) {
      new AnnotationConfiguration().configure().buildSessionFactory();
   }


Any idea where those references which keep the old hibernate objects alive could come from? I already tried to inspect the object graph but wasn't very successful.

I was using hibernate-3.5.6.

Thank you in advance, Clemens


Top
 Profile  
 
 Post subject: Re: Each time Hibernate is re-inited, ~30mb heap are gone
PostPosted: Fri Apr 15, 2011 3:19 pm 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
Just found the method SessionFactory.close(), which when called seems to release all the references held :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.