C
cameron
I need to get the size of an objet in memory. I have tried:
System.IO.MemoryStream m = new System.IO.MemoryStream();
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter b = new
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
b.Serialize(m, Obj);
double size = Convert.ToDouble(m.Length);
but not everything is serializable. The thing is I want to be able to
take an arbitarty object, (since everything I am attempting to size is
comming out of the cache), and get the size of it. I am wondering if it
not possible to treat it like a stream or a byte array or something like
that so that it is easy to get the size. I don't need any attributes off
of the object, I just need the size. Anyone have any ideas?
-Cam
System.IO.MemoryStream m = new System.IO.MemoryStream();
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter b = new
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
b.Serialize(m, Obj);
double size = Convert.ToDouble(m.Length);
but not everything is serializable. The thing is I want to be able to
take an arbitarty object, (since everything I am attempting to size is
comming out of the cache), and get the size of it. I am wondering if it
not possible to treat it like a stream or a byte array or something like
that so that it is easy to get the size. I don't need any attributes off
of the object, I just need the size. Anyone have any ideas?
-Cam