question: public static long sizeOf ( Class clazz ) { long maxSize = headerSize ( clazz ) ; while ( clazz != Object . class ) { for ( Field f : clazz . getDeclaredFields ( ) ) { if ( ( f . getModifiers ( ) & Modifier . STATIC ) == 0 ) { long offset = unsafe . objectFieldOffset ( f ) ; if ( offset > maxSize ) { maxSize = offset + 1 ; } } } clazz = clazz . getSuperclass ( ) ; } return roundUpTo8 ( maxSize ) ; }
target:  Returns the size of an instance of this class (in bytes). Instances include a header + all fields + padded to 8 bytes. If this is an array, it does not include the size of the elements.