Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

foot print new object

 
manuel franco
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,the memory space coumed by one objtect whit 100 attributes is the same that 100 objects whit 1 attribute each one?
thanks
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to Javaranch manuel franco ,

hi,the memory space coumed by one objtect whit 100 attributes is the same that 100 objects whit 1 attribute each one?


100 objects with one attribute each will eat more space. Anyways both are memory inefficient.
 
Tim Holloway
Bartender
Posts: 18419
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A lot of it depends on the attribute type. If a single object has 100 attributes, but each attribute is itself an object, you're talking 101 objects total. However, if all 100 objects are primitives, they'll all be housed within the containing object and you'll have 1 large object.

But I wouldn't design an application strictly on this basis anyway. First, I'd determine if I really needed 100 of either.
 
Rory Marquis
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To throw a random answer in, if you have 100 String objects that are exactly the same, depending on how you created them you will only be using the space of one String on the heap.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!