title: How to calculate Java array's memory size?
body: <p>I know how to calculate a Java object's memory size by adding three parts: header + properties + reference.</p>
  
  <p>I also know that a Java array is an object too.</p>
  
  <p>But when I read "Understanding the JVM advanced Features and Best Practices, second Edition", it says Java array's header consists of three parts; mark word, class pointer and array length.</p>
  
  <p>It will always be 24 bytes in Hotspot 64-bits JVM.</p>
  
  <p>But in a 32-bit JVM, how can I calculate a Java array's memory size?</p>
  
  <p>I hope you guys can give me some example Java code to show me how to calculate an object's memory size not, limited to array object.</p>