-->
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: session never collected
PostPosted: Fri Dec 09, 2005 2:26 pm 
Newbie

Joined: Fri Dec 09, 2005 2:22 pm
Posts: 16
I used the following code to test the memory management (I have a pb) :

Configuration cfg = new Configuration();
cfg.AddAssembly("DomainData");
ISessionFactory factory = cfg.BuildSessionFactory();

for(int i=0;i<100000;i++)
{
ISession session = factory.OpenSession();
//ITransaction tr = session.BeginTransaction();
//tr.Commit();
session.Close();
}

it works fine but if I uncomment the transaction code the sessions are never collected.

Any idea ?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 10, 2005 8:03 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Are you getting an exception?

Anyway, you might read this:
http://nhibernate.sourceforge.net/NHibernateEg/NHibernateEg.Tutorial1A.html#NHibernateEg.Tutorial1A-Persistence
To see how a session should be used...

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 10, 2005 11:00 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
I don't have the answer, I think, but I have two thoughts on this. First, I would call session.Dispose() after (or instead of) session.Close(). Secondly, you are creating one hundred thousand sessions, doing nothing with them, and expecting the garbage collector to keep up? I don't think it can keep up.


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.