Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

Multiple Class Instances and Memory

Thread view: 
Hal Vaughan - 15 Sep 2006 09:28 GMT
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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.