-->
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.  [ 4 posts ] 
Author Message
 Post subject: Huge Memory Leaks
PostPosted: Sun Oct 23, 2005 1:36 pm 
Newbie

Joined: Sun Oct 23, 2005 1:17 pm
Posts: 2
Location: Jacksonville, FL
Hello everyone!

I'm integrating NHibernate into a project. Pretty complicated system overall. It's a real time communications and location tracking system for hospitals. We have a SQL Server database sitting at the middle of the system. A couple of hardware drivers that are similar to device drivers that talk to all of the hardware in the hospital. Multiple windows forms instances which serve as our communication terminals and an ASPX web-app for reporting, configuration and non-real time GUI. Fun system to work on. Real time programming is fun.

Anyway, each of our program modules contains a instance of NHibernate to access the SQL database. The two long running 24/7 hardware driver modules start out using a reasonable amount of memory and end up eventually consuming all of the memory resources of the server given enough time.

The way that I am accessing NHibernate is that at program init I configure NHibernate and create a session that is alive for the duration of program run (forever). Then for each atomic database activity I create a session, perform the database action and close the session. For update (non-read only) I also create a Transaction.

Is this an acceptable way to use NHibernate in my apps or could this MO be contributing to my memory leaks?

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 24, 2005 9:51 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Hi,

Your system looks really interesting :wink:

What's the purpose of the "session that is alive for the duration of program run (forever)."?
Sessions should be short-living... (read the long post in the Windows Form section)
This session might consume a lot of memory because its cache will progressivly grow...

And I don't see the memory leak problem.

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 24, 2005 3:24 pm 
Thank you. It is really interesting and at the same time kindof mind boggling. It's a whole different level of design than a simple multi-user web-app going against a database.

I miss-stated that the session lives forever. That is incorrect, the session is created and destroyed per transaction. The SessionFactory lives forever.

It's to the point where I'll probably have to put a profiler on the running apps and see where all that memory is allocated.



KPixel wrote:
Hi,

Your system looks really interesting :wink:

What's the purpose of the "session that is alive for the duration of program run (forever)."?
Sessions should be short-living... (read the long post in the Windows Form section)
This session might consume a lot of memory because its cache will progressivly grow...

And I don't see the memory leak problem.


Top
  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 4:10 am 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
Quote:
It's to the point where I'll probably have to put a profiler on the running apps and see where all that memory is allocated.


That's probably the best bet. I had a nasty memory leak that I couldn't trace and after using a memory profiler it became obvious - it turned out to be a couple of collections I had in an interceptor that weren't cleared and so kept on growing.

Best of luck!

Cheers,

Symon.


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