Hi Johann, > Mark Burton schrieb: > >> As the object sizes are rounded to multiples of 8, it > >> looks like a case of buy one, and get 7 for free! > >> > > > > Yes, just tried that and the same amount of memory is used for 1 > > boolean and 8 booleans. > > > > > Sorry, I cannot confirm this.
But your figures below do confirm that, don't they? > Out of personal interest I have run your test programm with OpenJDK6 and > get following results: > > joh...@ubuntu910:~/workspace>java Test > Size for LotsOfBooleans: 87978536 > Average size: 87.978536 > Size for LotsOfInts: 336000000 > Average size: 336.0 > > > This means 1Byte/Boolean and 4Bytes/Int plus 8 Byte per Instance of > object, as I expected it. > Maybe I had to run the vm with a java option? Yes, but if you only have 1 boolean in the class with the ints it still uses 336 bytes. So you get 7 for free! If you add no booleans to the class, the size is 328. So I guess that's why they say that some people think the class is half empty while the others say that the class is half full! Cheers, Mark _______________________________________________ mkgmap-dev mailing list [email protected] http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
