By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,432 Members | 790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,432 IT Pros & Developers. It's quick & easy.

ASP.NET Session State Server and garbage collection

P: n/a

Our system maintains session state using the ASP.NET State Server service. We expect some of our session state objects to be over 85K, which categorizes them to be VLO's (very large objects) in terms of .NET memory allocations. This means that these objects will be allocated in a special managed heap for large objects. This makes sense since this would require some work for the garbage collector to move and compact these objects during a GC (garbage collection). Regardless, this means that these objects will eventually be placed in generation 2 of the directed graph of objects that the GC maintains

My questions are the following
1) When do objects contained within the state server get garbage collected? When the session "ends"?
a) If this is true, what event triggers the state server to tell it the session has ended?

2) Can I say that the objects will be ready for collection when I call Session.Abandon()? I heard that Session.Abandon() only signals the end of a Session for in-proc mode. Is this true

3) Does the fact that our objects are allocated on a separate "special" heap for very large objects influence how they are garbage collected

Thanks
Fran

Nov 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
see inline >>>

"Frank" <ex*************@aol.com> wrote in message
news:A0**********************************@microsof t.com...

Our system maintains session state using the ASP.NET State Server service.
We expect some of our session state objects to be over 85K, which
categorizes them to be VLO's (very large objects) in terms of .NET memory
allocations. This means that these objects will be allocated in a special
managed heap for large objects. This makes sense since this would require
some work for the garbage collector to move and compact these objects during
a GC (garbage collection). Regardless, this means that these objects will
eventually be placed in generation 2 of the directed graph of objects that
the GC maintains.

My questions are the following:
1) When do objects contained within the state server get garbage collected?
When the session "ends"?
a) If this is true, what event triggers the state server to tell it
the session has ended?
session timeout based on last access (this timeout is set in web.config). when the timeout happens, any session objects are released, and
thus availiable for GC.

2) Can I say that the objects will be ready for collection when I call
Session.Abandon()? I heard that Session.Abandon() only signals the end of a
Session for in-proc mode. Is this true?

yes. for non inproc, the session objects are created on page init, by reserializing from the store. at the end of the page request, the session
objects are seialized to the store and released, ready for GC
3) Does the fact that our objects are allocated on a separate "special"
heap for very large objects influence how they are garbage collected?
somewhat, but don't worry. GC's normally create different heaps for

different object sizes to prevent fragmentation of the heap. normally you
would not GC a heap, until you needed the space. as the the number of large
allocation requests is smaller than the number of small allocation
requests, the smaller heaps are GC'd more often.


Thanks,
Frank

Nov 18 '05 #2

P: n/a

Thanks for your response Bruce. This does help.

I do have one more important question though. How does the state server know when to release the serialized objects in its store? Does the aspnet_wp process signal the service when a session has ended? or does this data exist forever until you recycle the state service process-I can't imagine this is true.

Nov 18 '05 #3

P: n/a
> I do have one more important question though. How does the state server
know when to release the serialized objects in its store? Does the aspnet_wp
process signal the service when a session has ended? or does this data exist
forever until you recycle the state service process-I can't imagine this is
true.
Be aware that there is a bug in the framework with large object allocations
thru v 1.0 to 1.1. The result of this bug is that memory allocated for these
large objects never gets reclaimed until the app domain unloads. The current
work around is to set the app to recycle at a particular thresh hold. This
is a very nasty bug because if left unchecked it can cripple the server.
There is an extensive discussion on this in microsoft*.framework

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Frank" <an*******@discussions.microsoft.com> wrote in message
news:C4**********************************@microsof t.com...
Thanks for your response Bruce. This does help.

I do have one more important question though. How does the state server know when to release the serialized objects in its store? Does the aspnet_wp
process signal the service when a session has ended? or does this data exist
forever until you recycle the state service process-I can't imagine this is
true.

Nov 18 '05 #4

P: n/a
Hello Alvin,

Thanks for the heads up on this issue. Can you supply the link to this discussion? I can't seem to find it.

Regards,
Frank
Nov 18 '05 #5

P: n/a
here is one link:
http://tinyurl.com/37emm

there is a Q article about this on microsoft's website. I can't find it at
the moment.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Frank" <an*******@discussions.microsoft.com> wrote in message
news:86**********************************@microsof t.com...
Hello Alvin,

Thanks for the heads up on this issue. Can you supply the link to this discussion? I can't seem to find it.
Regards,
Frank

Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.