473,698 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why Session.Abandon () does not reduce memory use?

in production environment we started to have a memory consumption problem at
"asp.net wp". after a hard work we have discovered that Session.Abandon ()
does not reduce references to objects added to the session and not reduce
memory use.

in Session_End function at Global.asax file we have added the following
lines of code:
== == == == == == == ==
for(int Item = 0; Item < Session.Count; Item++)
Session[Item] = null;
== == == ==

as i suspected it still does not free memory. finally a new line of code was
added "GC.Collect ()":
== == == == == == == ==
for(int Item = 0; Item < Session.Count; Item++)
Session[Item] = null;

GC.Collect();
== == == ==
after all of this the memory was free!!!.

Questions:

why Session.Abandon () does not reduce object references?

why Session.Abandon () does not internally force a colecction in order to
free memory?
Nov 19 '05 #1
3 3757
That is because the garbage collector doesn't run constantly. It will run
when it needs to, and reclaim memory then.

You should not be calling GC.Collect yourself.

"Ricardo Q.G." <Ricardo Q.G.@discussion s.microsoft.com > wrote in message
news:71******** *************** ***********@mic rosoft.com...
in production environment we started to have a memory consumption problem
at
"asp.net wp". after a hard work we have discovered that Session.Abandon ()
does not reduce references to objects added to the session and not reduce
memory use.

in Session_End function at Global.asax file we have added the following
lines of code:
== == == == == == == ==
for(int Item = 0; Item < Session.Count; Item++)
Session[Item] = null;
== == == ==

as i suspected it still does not free memory. finally a new line of code
was
added "GC.Collect ()":
== == == == == == == ==
for(int Item = 0; Item < Session.Count; Item++)
Session[Item] = null;

GC.Collect();
== == == ==
after all of this the memory was free!!!.

Questions:

why Session.Abandon () does not reduce object references?

why Session.Abandon () does not internally force a colecction in order to
free memory?

Nov 19 '05 #2
As a side note, depending on the exact problem you saw you may want to try
to call dispose/close if you have stored such objects in Session...
--
Patrice

"Marina" <so*****@nospam .com> a écrit dans le message de
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
That is because the garbage collector doesn't run constantly. It will run
when it needs to, and reclaim memory then.

You should not be calling GC.Collect yourself.

"Ricardo Q.G." <Ricardo Q.G.@discussion s.microsoft.com > wrote in message
news:71******** *************** ***********@mic rosoft.com...
in production environment we started to have a memory consumption problem at
"asp.net wp". after a hard work we have discovered that Session.Abandon () does not reduce references to objects added to the session and not reduce memory use.

in Session_End function at Global.asax file we have added the following
lines of code:
== == == == == == == ==
for(int Item = 0; Item < Session.Count; Item++)
Session[Item] = null;
== == == ==

as i suspected it still does not free memory. finally a new line of code
was
added "GC.Collect ()":
== == == == == == == ==
for(int Item = 0; Item < Session.Count; Item++)
Session[Item] = null;

GC.Collect();
== == == ==
after all of this the memory was free!!!.

Questions:

why Session.Abandon () does not reduce object references?

why Session.Abandon () does not internally force a colecction in order to
free memory?


Nov 19 '05 #3
Even further to the side, you really shouldn't be putting big things
into the Session. It's intended for UserIDs and the occasional little
string. If you have something living there that's big enough to notice
in the aspnet_wp process, you should probably consider refactoring your
application.

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3538
by: Frank | last post by:
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...
4
8838
by: Andy Fish | last post by:
Hi, I have an asp.net application that is using Forms Authentication and maintaining http session state using cookies in the normal way. when the user clicks the logout button I do this: Session.Clear(); Session.Abandon(); FormsAuthentication.SignOut();
2
4262
by: Hardin | last post by:
I have an app that uses the sessionID to track user navigation and usage through the application. It works fine except in one case: There is a point in the application where I want to "close" the user's tracking and handle the user as if he had just logged on. To do that, I need a new sessionID. But even if I call Session.Abandon(), the user's SessionID does not change -- it just dumps session values. How can I force a new...
4
1885
by: Hugo Flores | last post by:
Hi all, I noticed that there are three methods that can remove session variables Session.Clear() Session.RemoveAll() Session.Abandon() Now my question as is stated on the subject, what is the best way to end a session?
10
2183
by: Li Pang | last post by:
Hi, I created a html page from which I give a link to another web site. The new site is opened in a new window. When I opened multiple windows, they all have the same SessionID. I want ot know how to open the windows with different sessionID. Thanks
1
2151
by: Mike McDonald | last post by:
I am trying to free up some memory by forcing a session.clear and a session.abandon. When I startup the application, it starts at about 80,000 KB of memory in the aspnet_wp.exe. I am able to load a huge data table into a session variable and watch my aspnet_wp.exe (w3wp.exe on 2003 server) increase it's memory usage by about 70,000 KB to 150,000 KB. I then click a Logout button, which uses Session.Clear and Session.Abandon. The memory...
1
6868
by: pulaki | last post by:
Greetings and thank you! I am passing form data to a distant server that is out of my control. The destination server (posting to) rejects all postings beyond ONE from the same session ID. I am trying to get around this...my postings are valid but I can't get the programmers on the other end to accomodate me. I am doing the following: Data is posted, from elsewhere, to me in an ASP page.
2
1489
by: Nathan Sokalski | last post by:
I have an application that is using Session state. On one page, I use the Session.Add() method to create the Key/Value pair for the first time. I am then sent to another page using Response.Redirect(). On the page I am sent to, I can view the Session's value using Session("mykey"), but it will not let me remove or modify it. I have tried Session("mykey"), Session.Remove("mykey"), Session.Clear(), and Session.Abandon(). None of these seemed...
16
1836
by: Jonathan Wood | last post by:
Greetings, I was wondering if anyone here has a good understaning of the Session object. I know there are options like the Session.Abandon method and the regenerateExpiredSessionId setting, although I do not understand what they do. Can anyone tell me if it's possible for a recycled session to still contain the old data? I had a couple of reports that where users said they logged on and saw another user's data. On this site, there...
0
8603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
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
9027
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...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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.