views:

188

answers:

2

Possible Duplicate:
How to find out size of session in ASP.NET from web application?

Hi,

Is there any way to know the memory size occupied by session variables in asp.net application?

Thanks, P.Gopalakrishnan.

+1  A: 

(marked wiki re duplicate; I was going to delete, but some things may be useful)

It will vary on the provider; for the in-memory state provider, you way as well ask "how big is an object/graph" - and the answer is... tricky at best. However, there are other providers, that typically use BinaryFormatter to serialize the data to a database etc. And it is then relatively easy to measure - either as part of your real system, or by just running it through BinaryFormatter yourself.

However, the real question is: are you seeing a problem? Sometimes, using a non-trivial amount of memory is fine and normal. Of course, relying on in-memory session (when IIS does app-pool recycling regularly) may be inadvisable...

Marc Gravell
Yes, I have the problem that session [mode: InProc] is getting expired frequently even the timeout property has been set to 120 minutes. I think this problem is due to recycling the worker process by IIS.
gopal
A: 

see

http://stackoverflow.com/questions/198082/how-to-find-out-size-of-session-in-asp-net-from-web-application

Jack B Nimble
Thanks - I hadn't seen that dup; I've closed as dup and flagged my answer "wiki" in response.
Marc Gravell