/** * {@inheritDoc} * <p> * With no-compressed oops we have internal padding between AbstractList and ArrayList that must * be counted for. */ @Override public long getSizeOf(List<?> arrayList, int initialCapacity) { if (null == arrayList) { return 0; } int capacity = getArrayCapacity(arrayList.size(), initialCapacity); // first AbstractList long size = alignTo8Bytes(this.getSizeOfObjectHeader() + this.getPrimitiveTypesSize(0, 0, 1, 0, 0, 0)); // then ArraList size = alignTo8Bytes(size + this.getPrimitiveTypesSize(1, 0, 1, 0, 0, 0)); size += this.getSizeOfArray(capacity); return alignTo8Bytes(size); } }
/** * {@inheritDoc} */ @Override public IObjectSizes getObject() throws Exception { boolean compressedOops = UnderlyingSystemInfo.IS_COMPRESSED_OOPS; if (!compressedOops) { return new ObjectSizes64Bits(); } else { return new ObjectSizes64BitsCompressedOops(); } }