开发者

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 :(

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜