Sizeof objects 
Author Message
 Sizeof objects

How can I tell the size of an object in VB?  I have a
dataset that I am filling with schema info and I want to
find out how much memory it is taking to see if it is
worth it to keep it in memory.


Tue, 25 Oct 2005 02:05:31 GMT  
 Sizeof objects
Hi Tobe,

That's not really that easy to do without actually tracing the individual
objects. For example, if an object has a string field, that could point to a
large string or a small string or even to a null string. Thing is, if those
strings are interned, then there could be other objects referencing the same
string. So without do a complete memory trace you can't accurately gauge
this.
Probably the best rough guide you will get is from trying to serialize the
object, or in this case as the dataset is a MarshalByValueComponent, you
could try get the length of the xml.
An alternative is to let the GC maybe take control of this and use weak
references and provide your own automatic resurrection as needed.
Or, one other approach would be just to get the count of row x columns *
column size using an approximation for the length of strings in string
columns.


Quote:
> How can I tell the size of an object in VB?  I have a
> dataset that I am filling with schema info and I want to
> find out how much memory it is taking to see if it is
> worth it to keep it in memory.



Tue, 25 Oct 2005 16:14:38 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. sizeof for VB objects?

2. VB6 SizeOf Method

3. SizeOf as in C

4. SizeOf Directory

5. sizeof

6. Q: "Sizeof" in VB

7. sizeof in VB5?

8. Sizeof

9. Sizeof in vb?

10. Memory allignment and sizeof() equivalent

11. Sizeof in VB

12. Q: sizeof operator

 

 
Powered by phpBB® Forum Software