I know I always post a similar question about array memory usage but now I want post the question more specific.
After I read this article: http://www.javamex.com/tutorials/memory/object_memory_usage.shtml
I didn't understand some things:
- the size of a data type is always the same also on different platform (Linux / Windows 32 / 64 bit)??? so an int will be always 32 bit?;
- when I compute the memory usage I must put also the reference value itself? If I have an object to a class that has an int field its memory will be 12 (object header) + 4 reference + 4 (the int field) + 3 (padding) = 24 bytes??