32-bit OS: 2x4=8 bytes overhead per object
64-bit OS: 2x8=16 bytes overhead per object
arrays take like 12 more bytes.
(Sun Hotspot VM)
In this case 20 million objects would eat up around 160 Megs, references for these guys should be additional 80 Megs. Instantiating all these objects and storing into array end up using 436Megs according to windows task manager and using (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) on windows xp (32-bit). Am I wrong assuming that this should average in the range of 260-280 Megs.