Calculate memory usage of Java objects

With Twitter’s ObjectSizeCalculator

If you are looking for an easy way to estimate the object size than this could interest you.

// gradle dependency
compile group: 'com.twitter.common', name: 'objectsize', version: '0.0.12'


The memory size of your object depends on the architecture, the actual vm implementation and whether the VM is 32 or 64-bit. ObjectSizeCalculator supports only the Hotspot JVM.

For more information see the javadoc ObjectSizeCalculator.