title: size of java byte[] in memory
body: <p>So i created a very large array of byte[] so something like byte[50,000,000][16].. so according to my math thats 800,000,000 bytes which is 0.8GB plus some overhead.
  To my surprise when to do </p>
  
  <pre><code>memoryBefore = runtime.totalMemory() - runtime.freeMemory()
  </code></pre>
  
  <p>its using 1.8GB of memory. when i point a profiler  at it i get this</p>
  
  <p><a href="https://www.dropbox.com/s/el9vlav5ylg781z/Screen%20Shot%202015-08-30%20at%202.55.00%20pm.png?dl=0" rel="nofollow">https://www.dropbox.com/s/el9vlav5ylg781z/Screen%20Shot%202015-08-30%20at%202.55.00%20pm.png?dl=0</a></p>
  
  <p>I can see most byte[] are 24bytes not 16 as expected and i see quite a few much larger byte[] of size 472 or more.. Does anyone know whats going on here?</p>
  
  <p>Thanks for reading</p>