code: @Override
      public long sizeOf(Object obj) {
          if (obj.getClass().isArray()) {
              Class<?> klazz = obj.getClass();
              int base = UNSAFE.arrayBaseOffset(klazz);
              int scale = UNSAFE.arrayIndexScale(klazz);
              long size = base + (scale * Array.getLength(obj));
              size += CURRENT_JVM_INFORMATION.getFieldOffsetAdjustment();
              if ((size % CURRENT_JVM_INFORMATION.getObjectAlignment()) != 0) {
                  size += CURRENT_JVM_INFORMATION.getObjectAlignment() - (size % CURRENT_JVM_INFORMATION.getObjectAlignment());
              }
              return Math.max(CURRENT_JVM_INFORMATION.getMinimumObjectSize(), size);
          } else {
              for (Class<?> klazz = obj.getClass(); klazz != null; klazz = klazz.getSuperclass()) {
                  long lastFieldOffset = -1;
                  for (Field f : klazz.getDeclaredFields()) {
                      if (!Modifier.isStatic(f.getModifiers())) {
                          lastFieldOffset = Math.max(lastFieldOffset, UNSAFE.objectFieldOffset(f));
                      }
                  }
                  if (lastFieldOffset > 0) {
                      lastFieldOffset += CURRENT_JVM_INFORMATION.getFieldOffsetAdjustment();
                      lastFieldOffset += 1;
                      if ((lastFieldOffset % CURRENT_JVM_INFORMATION.getObjectAlignment()) != 0) {
                          lastFieldOffset += CURRENT_JVM_INFORMATION.getObjectAlignment() -
                                             (lastFieldOffset % CURRENT_JVM_INFORMATION.getObjectAlignment());
                      }
                      return Math.max(CURRENT_JVM_INFORMATION.getMinimumObjectSize(), lastFieldOffset);
                  }
              }
  
              long size = CURRENT_JVM_INFORMATION.getObjectHeaderSize();
              if ((size % CURRENT_JVM_INFORMATION.getObjectAlignment()) != 0) {
                  size += CURRENT_JVM_INFORMATION.getObjectAlignment() - (size % CURRENT_JVM_INFORMATION.getObjectAlignment());
              }
              return Math.max(CURRENT_JVM_INFORMATION.getMinimumObjectSize(), size);
          }
      }
docs: {@inheritDoc}