473,725 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3545
see inline >>>

"Frank" <ex************ *@aol.com> wrote in message
news:A0******** *************** ***********@mic rosoft.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*.fram ework

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Frank" <an*******@disc ussions.microso ft.com> wrote in message
news:C4******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:86******** *************** ***********@mic rosoft.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
3309
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 and a couple "better pratice" code. Not perfect, but better. Problem : I'm testing everything with Firefox on my machine (IIS on WinXP Pro), and everything is ok. As soon as I try MS IE 6, it doesn't seem to keep the sessions from page to...
5
2009
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 store the user name in a regular session variable but the collection varies in size based on the user and could grow in the future as the application grows. I don't want to keep going back to the database for this info every time because it's needed...
13
2856
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 visit again .... null ... again .... it works ..... again ... it works ... again ..... null....... and so on and on .... it does randomly work or not.... what is this effect?
9
5311
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 copy paste (I hear this will improve in ASP.Net 2 via master pages). When I navigate from one page to the next the header and footer user controls lose their state because they are effectively different instances of the user control. Is there...
7
2046
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, it retreives the Menu from session and assigns its reference to Menu1. Within the Page_Load event I can see its internal values which have been retreived for each menu item and so it looks good. However, when the Render method is called of...
6
1760
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: 1) When is memory used for Session State freed (or essentially freed)? - if ever...
0
3236
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 documentation it seems it should do it anyway any advice?
1
8978
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 page creating the session and the new page. The problem just start when code was untouched. I am using PHP 4.4.7 on an Apache Server. Any help or suggestions would be welcomed here is my php.ini file ; Handler used to store/retrieve...
9
3870
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 me ;) MC
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8099
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.