-->
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.  [ 1 post ] 
Author Message
 Post subject: hibernate or nhibernate will cause memory leak?
PostPosted: Fri Nov 18, 2005 4:47 am 
Newbie

Joined: Fri Nov 18, 2005 4:30 am
Posts: 1
i cannot understand what reson will cause this problem? code is below:

public class ConfigReader
{
private static WeakReference sfcache = new WeakReference(null);

private static WeakReference configCache = new WeakReference(null);


public static ISessionFactory SessionFactory
{
get
{
ISessionFactory _sessions = sfcache.Target as ISessionFactory;
if ( _sessions == null )
{
_sessions = ;
sfcache.Target = _sessions;
}

return _sessions;
}
}

public static Configuration Configuration
{
get
{
Configuration _config = configCache.Target as Configuration;
if ( _config == null )
{
_config = new Configuration().Configure();
configCache.Target = _config;
}

return _config;
}
}
}

public class XXX
{
public static IList query( string sql )
{
IList _list = null;
using (ISession _session = ConfigReader.SessionFactory.OpenSession())
{
_list = _session.Find( sql );
_session.Close();
}

return _list;
}
}


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

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.