B
Brendan Guild
How much memory overhead is there in objects? I remember reading that
even an object from a class with just one variable takes several
bytes, but I cannot recall just how bad it is.
How much memory overhead is there in arrays? I'm thinking about having
potentially very long arrays, and wondering if I would get significant
savings by using several parallel arrays of primitives instead of an
array of objects. I would wrap the arrays so that when accessed an
object is created containing a reference to the arrays and an index,
so that the parallel arrays would be like an array of objects. But
this means creating lots of temporary objects and giving the gc more
work. How wasteful is that?
even an object from a class with just one variable takes several
bytes, but I cannot recall just how bad it is.
How much memory overhead is there in arrays? I'm thinking about having
potentially very long arrays, and wondering if I would get significant
savings by using several parallel arrays of primitives instead of an
array of objects. I would wrap the arrays so that when accessed an
object is created containing a reference to the arrays and an index,
so that the parallel arrays would be like an array of objects. But
this means creating lots of temporary objects and giving the gc more
work. How wasteful is that?