Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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  
v2

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



Advertise | Privacy | Mobile
Web03 | 2.8.141022.2 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100