/** * 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; } }
/** * 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; } }
/** * 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; }
size += CachedDeserializableFactory.overhead();
/** * 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; }
size += CachedDeserializableFactory.overhead();
result += overhead();
result = getArrayOfBytesSize((byte[][])o, false); } else if (o instanceof CachedDeserializable) { result = ((CachedDeserializable)o).getSizeInBytes() + 4 - overhead(); } else if (o instanceof Sizeable) { result = ((Sizeable)o).getSizeInBytes() + 4;
if (!preferObject() && o instanceof CachedDeserializable) { result -= overhead();
result += overhead();
Set<String> inVMSet = new HashSet(); int perEntryOverhead = ((PartitionedRegion)aRegion).getPerEntryLRUOverhead(); int cdOverhead = CachedDeserializableFactory.overhead(); Log.getLogWriter().info("perEntryOverhead is " + perEntryOverhead); Log.getLogWriter().info("Analyzing " + highestKeyIndex + " entries...");
long evictionSizeAfterGet = getSizeFromEvictionStats(vm1); assertEquals(1, getObjectSizerInvocations(vm1)); assertEquals(200000+CachedDeserializableFactory.overhead() - vSize, evictionSizeAfterGet - finalEvictionSize1);
assertEquals(1, getObjectSizerInvocations(vm0)); assertEquals(0, getObjectSizerInvocations(vm1)); assertEquals(200000+CachedDeserializableFactory.overhead() - vSize, evictionSizeAfterGet - finalEvictionSize0); assertEquals(0, prSizeAfterGet - finalPRSize0);