http://nhforge.org/doc/nh/en/index.html#architecture-current-session

On Wed, Feb 9, 2011 at 4:44 PM, Paul Allington <
[email protected]> wrote:

> But that's what I'm stumped on - there's no way a session could be left
> open:
>
> Begin request:
>
>             ManagedWebSessionContext.Bind(HttpContext.Current,
> SessionFactory.OpenSession());
>
> End request:
>
>             ISession session =
> ManagedWebSessionContext.Unbind(HttpContext.Current, SessionFactory);
>             if (session != null)
>             {
>                 if (session.Transaction != null &&
> session.Transaction.IsActive)
>                 {
>                     session.Transaction.Rollback();
>                 }
>                 else
>                 {
>                     session.Flush();
>                 }
>
>                 session.Close();
>                 session.Dispose();
>             }
>
> *
> *
>   *Paul Allington [image: See my 
> profile]<http://www.intelligentpenguin.co.uk/about/theteam/paul>
> *
> *T:* 01799 522 665
> *M:* 07973 145 754
> *E:* [email protected]
> *W:* www.intelligentpenguin.co.uk
> *W:* www.creative-penguin.co.uk
>  [image: Intelligent Penguin] <http://www.intelligentpenguin.co.uk>  For
> highly creative & technically brilliant websites, and on-line management
> systems
>
> ------------------------------------------------------------------------------
>   My
> profiles: [image: Facebook] <http://www.facebook.com/paulallington>[image:
> LinkedIn] <http://uk.linkedin.com/in/paulallington>[image: 
> Twitter]<http://twitter.com/paulallington>
> Contact me: [image: Google Talk/]phallington [image: Skype/]paul-allington
> [image: Y! messenger/]paul_allington
>
>
>
>
> On Wed, Feb 9, 2011 at 7:28 PM, Fabio Maulo <[email protected]> wrote:
>
>> If you find a reference of one of your entities in
>> the StatefulPersistenceContext is because you have an opened session with
>> those entities uploaded.
>> If it seems to be unexpected then you a leaving opened some sessions.
>>
>> On Wed, Feb 9, 2011 at 4:19 PM, Paul Allington <
>> [email protected]> wrote:
>>
>>> Yeah, that's just it - I'd expect them to not be referenced at all - but
>>> they're referenced indirectly to the SessionFactory.  Some of them are
>>> referenced by: "SingleTableEntityPersister"  or the
>>> "StatefulPersistenceContext"
>>>
>>> *
>>> *
>>>   *Paul Allington [image: See my 
>>> profile]<http://www.intelligentpenguin.co.uk/about/theteam/paul>
>>> *
>>> *T:* 01799 522 665
>>> *M:* 07973 145 754
>>> *E:* [email protected]
>>> *W:* www.intelligentpenguin.co.uk
>>> *W:* www.creative-penguin.co.uk
>>>  [image: Intelligent Penguin] <http://www.intelligentpenguin.co.uk>  For
>>> highly creative & technically brilliant websites, and on-line management
>>> systems
>>>
>>> ------------------------------------------------------------------------------
>>>   My
>>> profiles: [image: Facebook] <http://www.facebook.com/paulallington>[image:
>>> LinkedIn] <http://uk.linkedin.com/in/paulallington>[image: 
>>> Twitter]<http://twitter.com/paulallington>
>>> Contact me: [image: Google Talk/]phallington [image: Skype/]paul-allington
>>> [image: Y! messenger/]paul_allington
>>>
>>>
>>>
>>>
>>> On Wed, Feb 9, 2011 at 7:15 PM, John Davidson <[email protected]>wrote:
>>>
>>>> What you are probably seeing then is delayed garbage collection. The
>>>> ANTS profiler should show haw many references there are to the objects in
>>>> question. If you think the object should not be there then the reference
>>>> should be zero. If it is not zero then it will not be collected.
>>>>
>>>> I am in the habit of always setting obects = null when finished with
>>>> them. I have found it saves a lot of grief.
>>>>
>>>> John Davidson
>>>>
>>>> On Wed, Feb 9, 2011 at 2:08 PM, Paul Allington <
>>>> [email protected]> wrote:
>>>>
>>>>> Sorry - that's what this really based on.  I was running ANTS earlier
>>>>> today to find out just where all the memory is being used from, and about
>>>>> 90% of it is NHibernate and objects lingering around.  I've ignored all of
>>>>> the aspx stuff, as this is just first load, and while there is some other
>>>>> .net classes, it's mostly NHibernate.  I'm mostly concerned that my data
>>>>> objects are being held on to by the SessionFactory (2nd level cache is
>>>>> turned off) - for no good reason.  I'd also like to know why it needs to 
>>>>> use
>>>>> so much other memory, and unmanaged memory
>>>>>
>>>>> *
>>>>> *
>>>>>   *Paul Allington [image: See my 
>>>>> profile]<http://www.intelligentpenguin.co.uk/about/theteam/paul>
>>>>> *
>>>>> *T:* 01799 522 665
>>>>> *M:* 07973 145 754
>>>>> *E:* [email protected]
>>>>> *W:* www.intelligentpenguin.co.uk
>>>>> *W:* www.creative-penguin.co.uk
>>>>>  [image: Intelligent Penguin] <http://www.intelligentpenguin.co.uk>  For
>>>>> highly creative & technically brilliant websites, and on-line management
>>>>> systems
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>   My
>>>>> profiles: [image: Facebook] <http://www.facebook.com/paulallington>[image:
>>>>> LinkedIn] <http://uk.linkedin.com/in/paulallington>[image: 
>>>>> Twitter]<http://twitter.com/paulallington>
>>>>> Contact me: [image: Google Talk/]phallington [image: Skype/]paul-allington
>>>>> [image: Y! messenger/]paul_allington
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Feb 9, 2011 at 6:54 PM, John Davidson <[email protected]>wrote:
>>>>>
>>>>>> How many aspx pages do you have in the application. The web server
>>>>>> caches aspx related data. In my case the application starts at 90MB and
>>>>>> grows to around 115-120 MB where the growth stops after I have visited 
>>>>>> all
>>>>>> the pages. I have about 30 very heavy aspx pages. There is no additional
>>>>>> memory usage as I request different data of those pages as it is 
>>>>>> released at
>>>>>> the end of the request.
>>>>>>
>>>>>> If you really are concerned then I suggest you find a memory profiler
>>>>>>
>>>>>> A free one: http://www.xteprofiler.com/landing1.html (never used)
>>>>>> A commercial product from Red Gate: Memory Profiler for .NET - Locate
>>>>>> Memory Leaks in 
>>>>>> moments.<http://www.google.ca/aclk?sa=l&ai=CY_1ZuOJSTfzTOIiVggeS_u3oAeTp688B9LLh6Bm8o-C3MAgAEAEguVRQgvi8oQNg_bCagegDoAH0gcL_A8gBAaoEHE_Q3YcEdQw3LHJLlPnmt2geK0tH2NWX77Tjf3qABZBO&sig=AGiWqtzhR6-XuyPT19a-Ghy8RawzDaHOtA&adurl=http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/%3Futm_source%3Dgoogle%26utm_medium%3Dcpc%26utm_content%3Dunmet_need%26utm_campaign%3Dantsmemoryprofiler>
>>>>>>
>>>>>> John Davidson
>>>>>>
>>>>>>
>>>>>> On Wed, Feb 9, 2011 at 1:28 PM, Paul Allington <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> The first is how it's working - in fact I think I may have originally
>>>>>>> read that article to get the httpmodule to work.
>>>>>>>
>>>>>>> *
>>>>>>> *
>>>>>>>   *Paul Allington [image: See my 
>>>>>>> profile]<http://www.intelligentpenguin.co.uk/about/theteam/paul>
>>>>>>> *
>>>>>>> *T:* 01799 522 665
>>>>>>> *M:* 07973 145 754
>>>>>>> *E:* [email protected]
>>>>>>> *W:* www.intelligentpenguin.co.uk
>>>>>>> *W:* www.creative-penguin.co.uk
>>>>>>>  [image: Intelligent Penguin] <http://www.intelligentpenguin.co.uk>  For
>>>>>>> highly creative & technically brilliant websites, and on-line management
>>>>>>> systems
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>>   My
>>>>>>> profiles: [image: Facebook] 
>>>>>>> <http://www.facebook.com/paulallington>[image:
>>>>>>> LinkedIn] <http://uk.linkedin.com/in/paulallington>[image: 
>>>>>>> Twitter]<http://twitter.com/paulallington>
>>>>>>> Contact me: [image: Google Talk/]phallington [image: 
>>>>>>> Skype/]paul-allington
>>>>>>> [image: Y! messenger/]paul_allington
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Feb 9, 2011 at 6:21 PM, John Davidson 
>>>>>>> <[email protected]>wrote:
>>>>>>>
>>>>>>>> Are you using SessionPerRequest as described in
>>>>>>>>
>>>>>>>>
>>>>>>>> http://nhforge.org/blogs/nhibernate/archive/2010/07/11/nhibernate-bootstrapper-unitofwork-and-sessionperrequest.aspx
>>>>>>>>
>>>>>>>> If you are using that threading then check what FlushMode is.
>>>>>>>>
>>>>>>>> Also the NHibernate 3.0 Cookbook is an excellent reference NHibernate
>>>>>>>> 3.0 Cookbook<https://www.packtpub.com/nhibernate-3-0-cookbook/book>
>>>>>>>>
>>>>>>>> <https://www.packtpub.com/nhibernate-3-0-cookbook/book>John
>>>>>>>> Davidson
>>>>>>>>
>>>>>>>> On Wed, Feb 9, 2011 at 1:15 PM, Paul Allington <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> It's in an asp.net web app - it's just a simple architecture at
>>>>>>>>> the moment
>>>>>>>>>
>>>>>>>>> *
>>>>>>>>> *
>>>>>>>>>   *Paul Allington [image: See my 
>>>>>>>>> profile]<http://www.intelligentpenguin.co.uk/about/theteam/paul>
>>>>>>>>> *
>>>>>>>>> *T:* 01799 522 665
>>>>>>>>> *M:* 07973 145 754
>>>>>>>>> *E:* [email protected]
>>>>>>>>> *W:* www.intelligentpenguin.co.uk
>>>>>>>>> *W:* www.creative-penguin.co.uk
>>>>>>>>>  [image: Intelligent Penguin]<http://www.intelligentpenguin.co.uk>  
>>>>>>>>> For
>>>>>>>>> highly creative & technically brilliant websites, and on-line 
>>>>>>>>> management
>>>>>>>>> systems
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>>   My
>>>>>>>>> profiles: [image: 
>>>>>>>>> Facebook]<http://www.facebook.com/paulallington>[image:
>>>>>>>>> LinkedIn] <http://uk.linkedin.com/in/paulallington>[image:
>>>>>>>>> Twitter] <http://twitter.com/paulallington>
>>>>>>>>> Contact me: [image: Google Talk/]phallington [image: 
>>>>>>>>> Skype/]paul-allington
>>>>>>>>> [image: Y! messenger/]paul_allington
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Feb 9, 2011 at 6:13 PM, John Davidson <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> What are the general archictural components? and what is your
>>>>>>>>>> threading model?
>>>>>>>>>>
>>>>>>>>>> John Davidson
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, Feb 9, 2011 at 12:49 PM, Paul <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hello
>>>>>>>>>>>
>>>>>>>>>>> I'm having issues with NHibernate and the amount of memory it
>>>>>>>>>>> uses.
>>>>>>>>>>> I've tried turning off all caching, however the data objects that
>>>>>>>>>>> are
>>>>>>>>>>> loaded in each session are still persisting in memory, which
>>>>>>>>>>> isn't
>>>>>>>>>>> great.  Memory profiling shows that they're being held on to by
>>>>>>>>>>> the
>>>>>>>>>>> factory (the session has been disposed)
>>>>>>>>>>>
>>>>>>>>>>> NHibernate seems to just consume about 60MB of my app with no
>>>>>>>>>>> reason -
>>>>>>>>>>> and about 30MB of that appears to be in unmanaged code...
>>>>>>>>>>>
>>>>>>>>>>> Any ideas?  I'm tearing my hair out!
>>>>>>>>>>>
>>>>>>>>>>> Thanks, Paul
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>> Google Groups "nhusers" group.
>>>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>>>> [email protected].
>>>>>>>>>>> For more options, visit this group at
>>>>>>>>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>  --
>>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>>> Groups "nhusers" group.
>>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>>> [email protected].
>>>>>>>>>> For more options, visit this group at
>>>>>>>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  --
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "nhusers" group.
>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>> [email protected].
>>>>>>>>> For more options, visit this group at
>>>>>>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>>>>>>
>>>>>>>>
>>>>>>>>  --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "nhusers" group.
>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>> [email protected].
>>>>>>>> For more options, visit this group at
>>>>>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "nhusers" group.
>>>>>>> To post to this group, send email to [email protected].
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> [email protected].
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>>>>
>>>>>>
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "nhusers" group.
>>>>>> To post to this group, send email to [email protected].
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected].
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>>>
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "nhusers" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected].
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nhusers" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "nhusers" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/nhusers?hl=en.
>>>
>>
>>
>>
>> --
>> Fabio Maulo
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>



-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to