java memory usage

Posted by xdevel2000 on Stack Overflow See other posts from Stack Overflow or by xdevel2000
Published on 2010-06-07T10:18:20Z Indexed on 2010/06/07 10:22 UTC
Read the original article Hit count: 225

Filed under:
|
|

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??

© Stack Overflow or respective owner

Related posts about java

Related posts about memory