Click here to Skip to main content
Sign Up to vote bad
good
See more: C#4.0
Hi All ,
i have temporary table that contain n numbers of record ,that table is stored in session now i want to know how much memory is occupied by session .
Thanks To All
Posted 30-Nov-12 20:01pm


2 solutions

long totalSessionBytes = 0;
BinaryFormatter b = new BinaryFormatter();
MemoryStream m;
foreach(var obj in Session)
{
  m = new MemoryStream();
  b.Serialize(m, obj);
  totalSessionBytes += m.Length;
}
  Permalink  
foreach(var obj in Session)
{
  m = new MemoryStream();
  b.Serialize(m, obj);
  totalSessionBytes += m.Length;
}
In foreach loop you wrote session. What is this session name or what?
I write my session name there, but control is not going inside of loop.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 6,889
1 Prasad_Kulkarni 3,671
2 OriginalGriff 3,359
3 _Amy 3,312
4 CPallini 2,925


Advertise | Privacy | Mobile
Web01 | 2.6.130617.1 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid