473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ASP.NET Session State Server and garbage collection


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
5 3523
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

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
> 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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals...
5
by: Pross | last post by:
I've got an ASP.NET application and I need some information on every page like the user's name as well as a collection listing which sections of the application the user has access to. I could...
13
by: Alexander Widera | last post by:
hi, who has seen the follow problem or could help please? i visit a page .... i read a sesssion-var . ... everythink works...... i visit the page again..... error ... the sessionvar is null .... i...
9
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of...
7
by: Mr Newbie | last post by:
I have written a Custom Control Menu. Its fairly simple but it works well enough. In order to simplify things I decided to store the Menu1 custom control in Session. In the page load event below,...
6
by: spacehopper_man | last post by:
I'm considering ditching all use of Session state in favour of Application state. This is because - from what I can work out - it will be more memory efficient for me. I have three questions:...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
1
by: KidQuin | last post by:
I am having problems with session value between pages. Happening in both firefox and IE7. I go between page by links so I know it's not header changes. I use session_start as the first line on the...
9
by: MC | last post by:
I would like to display a timer in the corner of the page that shows the user how many minutes:seconds till the session times out. Are there any good examples out there? Google has again failed...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.