简体   繁体   中英

Deleting/ abandoning ASP.NET session state server

I am learning about the State management in ASP.Net using sessions. I have recently used out of proc ASP.Net session state server for storing my application's session data. What I wish to know is what happens to a session in the asp.net session state server if it is Abandoned. How is the memory managed on the asp.net session state server's end. The behavior that I have observed is as follows: Initially before creating a session in my application I checked, through windows task manager, the memory being consumed by the asp.net session state process. It was around 2300 KB. Then I created a session in my application, serialized and added a lot of data to it, after which the asp.net session state process memory increased to about 4700 KB. Now I tried removing, clearing and abandoning(Session.Abandon()) the session but the memory consumed by asp.net session state process did not decrease, it stayed around 4300. Can you tell me if there is any explicit memory management steps to be followed for out of proc sessions or am I missing any basic steps here. How is this memory handled by asp.net session state process? If it is not how can I manage it?

Once you don't have any more references (including the Session object) to your data, the garbage collector will clean it up.

This is non-deterministic, so you don't know when that will happen, but it will, eventually.

If it does never happen, then you probably have other references to the data somewhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM