/** * Returns the approximate size of the object in the memory in bytes. * * @param objectSizes * Appropriate instance of {@link IObjectSizes} depending on the VM architecture. * @return Approximate object size in bytes. */ @Override public long getObjectSize(IObjectSizes objectSizes) { return this.getObjectSize(objectSizes, true); }
/** * {@inheritDoc} */ @Override public void calculateAndSetBufferElementSize(IObjectSizes objectSizes) { long size = objectSizes.getSizeOfObjectHeader() + objectSizes.getPrimitiveTypesSize(2, 0, 0, 0, 1, 0); if (null != object) { size += object.getObjectSize(objectSizes); } size += size * objectSizes.getObjectSecurityExpansionRate(); bufferElementSize = size; }
/** * {@inheritDoc} */ @Override public long getObjectSize(IObjectSizes objectSizes, boolean doAlign) { long size = super.getObjectSize(objectSizes, doAlign); size += objectSizes.getPrimitiveTypesSize(1, 0, 0, 0, 1, 0); if (parameterContentData instanceof HashSet) { size += objectSizes.getSizeOfHashSet(parameterContentData.size(), 0); for (ParameterContentData paramContentData : parameterContentData) { size += objectSizes.getSizeOf(paramContentData); } } if (doAlign) { return objectSizes.alignTo8Bytes(size); } else { return size; } }
when(defaultData.getObjectSize(objectSizes)).thenReturn(elementSize);
when(defaultData.getObjectSize(objectSizes)).thenReturn(1L);
when(defaultData.getObjectSize(objectSizes)).thenReturn(1L);
when(defaultData.getObjectSize(objectSizes)).thenReturn(1L);
when(defaultData.getObjectSize(objectSizes)).thenReturn(1L);
when(defaultData.getObjectSize(objectSizes)).thenReturn(1L);