ASP.NET Session State Server and garbage collection

G

Guest

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
 
B

bruce barker

see inline >>>

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?
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?

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?
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
 
G

Guest

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.
 
A

Alvin Bruney [MVP]

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 said:
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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top