Hi Daniel!
DPZ>How can I tell how much memory an object takes?
There is an article on www.javaworld.com about this topic (it's about clever
memory usage, I don't know the exact title, but there are'nt so many articles
to choose from). Depending on the VM, java.lang.Object takes some 20-30 bytes
just for itself. Any other class has this amount as base overhead, and
additional data. Since Double has one non-static member of type double, I
would expect that sizeof(Double)==sizeof(Object)+sizeof(double)+x.
DPZ>I'm interested to know how big a Dimension object or a Point2D.Double
DPZ>object is, compared to say, a
DPZ>primitive double.
Quite a bit larger (in any sense ;-) ).
DPZ>Would it make more sense just to keep my coordinates in double arrays
DPZ>make a shape and draw it, rather than keeping the whole
DPZ>shape in an array to draw it?
Depends on how often you rebuild your polygons. If you can recycle your double
arrays, then do this by any means! Your GC will have much less work to do. In
general, whereever you can use a native type like double or int, use it. I
would only use Dimension, Point etc. if some API absolutely insists on it (for
example, Component.getPreferredDimension() returns a Dimension object).
MbG, Ekkehard
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]