/** * Return how much memory this object will consume * if it is in serialized form */ public static int calcSerializedMemSize(Object o) { int result = calcSerializedSize(o); result += Sizeable.PER_OBJECT_OVERHEAD; if (!(o instanceof byte[])) { result += overhead(); } return result; } }
/** * Return how much memory this object will consume * if it is in serialized form * @since 6.1.2.9 */ public static int calcSerializedMemSize(Object o) { int result = calcSerializedSize(o); result += Sizeable.PER_OBJECT_OVERHEAD; if (!(o instanceof byte[])) { result += overhead(); } return result; } }
/** * Compute an estimate of the size of the new value * for a PR. Since PR's always store values in a cached deserializable * we need to compute its size as a blob. * * @return the size of serialized bytes for the new value */ public int getNewValSizeForPR() { int newSize = 0; applyDelta(false); Object v = basicGetNewValue(); if (v != null) { try { newSize = CachedDeserializableFactory.calcSerializedSize(v) + CachedDeserializableFactory.overhead(); } catch (IllegalArgumentException iae) { logger.warn(LocalizedMessage.create(LocalizedStrings.EntryEventImpl_DATASTORE_FAILED_TO_CALCULATE_SIZE_OF_NEW_VALUE), iae); newSize = 0; } } return newSize; }
/** * Compute an estimate of the size of the new value * for a PR. Since PR's always store values in a cached deserializable * we need to compute its size as a blob. * * @return the size of serialized bytes for the new value */ public final int getNewValSizeForPR() { int newSize = 0; applyDelta(false); Object v = basicGetNewValue(); if (v != null) { try { newSize = CachedDeserializableFactory.calcSerializedSize(v) + CachedDeserializableFactory.overhead(); } catch (IllegalArgumentException iae) { this.region.getCache().getLoggerI18n().warning( LocalizedStrings.EntryEventImpl_DATASTORE_FAILED_TO_CALCULATE_SIZE_OF_NEW_VALUE, iae); newSize = 0; } } return newSize; }