Hello!
I have written an application that does calender-stuff and for every day I use a day-object with the folloing member-variables:
public short state;
public char fSymbol;
public byte signSymbol;
public byte workMod;
public boolean tipAvail;
public boolean remindAvail;
public boolean hourTableAvail;
public boolean toDoAvail;
public boolean isEditable;
public int julianDay;
I theory such an object should need only 15byte + 2 byte Hotspot “per Object” overhead.
In reality one Object needs about 65 bytes which is nearly quad as much as it should need!
Where does all the memory go? I know that the jvm does some aligning, but what does it do here?
Does it put each variable onto the next machine-word-lenght?
This does not really bother me on desktop (except MSJVM which is god damn slow) but on J2ME powered mobiles this is really ugly!
Is there any other way than to put everything in ints and mascerade it?
Thanks in advance, lg Clemens
PS: I am using a P4 under Linux-2.6 so machine-word-lenght is 4 byte.