The level 1 cache is tied to the session, the level 2 cache is tied to the
session factory.

2016-05-25 3:28 GMT+02:00 Tyler Austen <[email protected]>:

> If I remember correctly, NHibernate's 1st-level cache is tied to the
> session factory (eg. lives beyond disposal of individual sessions)...  and
> is shared across all session instances allocated from the factory. This
> means that as your application runs, data will accumulate in this cache. It
> will look like a leak, and depending on your perspective, could be
> considered one except that the 1st level cache is intentional.
>
> I'm not sure what the answer to the "Why now?" question would be, but
> perhaps recent versions of NHibernate more aggressively lean on the
> 1st-level cache?
>
> Hopefully this helps,
>
> Tyler
>
>
> On Tuesday, April 19, 2016 at 8:14:19 AM UTC-7, Vincent Decrauzat wrote:
>>
>> We are using NHibernate in different products since years and without any
>> problem.
>> Recently, we are facing a memory leak issue in some new sites.
>> Investigating with a profiler, we have found that the problem is
>> NHibernate sessions that are not garbage collected.
>> This is really strange as all our interactions with NHibernate are
>> following this pattern:
>>
>> using(ISession session = nhibernateHelper.OpenSession())
>> {
>> // Read or write data...
>> }
>>
>> The helper is just a singleton that has a private session factory
>> initialized at startup.
>>
>> It must be somehow related to the environment, because exactly the same
>> binaries with exactly the same database are leaking on a machine but not on
>> another one.
>>
>> We have tried with different versions of .NET (4.5.2 and 4.6.1), no change
>> We have tried with software in debug or release. It leaks faster on
>> debug, but it leaks in both configurations.
>>
>> Our database is postgres 9.4
>> We are running on a Windows 2012 R2 server.
>> The software is running as a Windows service, it has <gcServer
>> enabled="true" /> in its app.config.
>>
>> What could be the cause for such memory leak ?
>> Has anybody also experienced such problems ?
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to