Memory leak with addionatl NHibernate listeners?
i'm using Configuration.AppendListeners for some addional listeners. With the appened listeners the destructor is only called when the program ends - without the additional listeners the destructor is called on System.GC.Collect.
Ad a workaround I implemented IDisposable where I call following method:
private void CleanUpConfigurationListener()
{
if (configuration == null) return;
foreach (NHibernate.Event.Liste开发者_Go百科nerType item in Enum.GetValues(typeof(NHibernate.Event.ListenerType)))
{
configuration.SetListener(item, null);
}
}
With it, the destructor is called again.
Is it a memory leak?
I'm using NH 3.0 because of Fluent NHibernate (1.2).
Thanks for your answers.
It was my fault. I found the problem:
The code created a new SessionFactory for each new DAL-Session object :(
精彩评论