What Heap Dumps Are Lying To You About
This post is also available in ePUB and mobi . This is an updated version of the Russian post I had roughly one year ago, way before Java Object Layout was available under OpenJDK, and the draft I had on GitHub was in infancy. The rationale for this post is to give the "runtime guy" perspective on every single blog post about Java object sizes and layouts. Part I. Myths Myth 0. You can figure out the object size once and for all In reality, it depends on number of things. Target VM: what exactly you are running with? HotSpot? JRockit? J9? ahem Dalvik? Platform bitness: reference sizes are probably different, or even the basic types take a different number of bytes. Potential and actual optimizations, a la object inlining, scalarized fields, paddings, etc. Myth 1. It is enough to sum up the field sizes to get the instance size In reality, VMs are free to choose the representation for the basic types. Moreover,Read full article from What Heap Dumps Are Lying To You About
No comments:
Post a Comment