I haven't had to consider memory or questions of speed vs. memory before,
but now I'm trying to plan out several data structures that are at the
heart of an application. Essentially, I need a number of data tables,
imported from a database and put in a format I can easily work with.
For the first time, I've looked closely at the sizes of compiled classes. I
figured everything would be compiled to byte code, so a class without much
in it would be quite small. When I looked at my classes, though, they were
bigger than I thought.
I'm considering using 2 classes, the first is TNTable, which would be the
class for holding a table of data, and the second is TNRow, which would be
a row of data, including flags to mark if a row has been deleted and index
numbers. There would be a large number of instances of these classes in
memory and there would be many cases of TNTable objects that would use a
subset of the same rows another TNTable uses.
Will I have a large amount of overhead for each instance of a class, or is
there an initial overhead for a type of class with other instances using
less memory? How can I guess about how much extra memory using one more
TNRow or TNTable will cost me?
Thanks for any insight into this.
Hal
Thomas Kellerer - 15 Sep 2006 09:46 GMT
> Will I have a large amount of overhead for each instance of a class, or is
> there an initial overhead for a type of class with other instances using
> less memory? How can I guess about how much extra memory using one more
> TNRow or TNTable will cost me?
The byte code for a class will only be loaded once into memory. The
memory that each instance uses is determined by the member variables
that it creates/allocates.
Thomas

Signature
It's not a RootKit - it's a Sony