.append(refCount).append(" @").append(Long.toHexString( aChunk.getMemoryAddress())).append("\n"); if (SimpleMemoryAllocatorImpl.trackReferenceCounts()) { List<RefCountChangeInfo> history = SimpleMemoryAllocatorImpl .getRefCountInfo(aChunk.getMemoryAddress());
refCountErrStr.append(localReg.getFullPath() + " key " + key + " has off-heap refCount " + refCount + " @" + Long.toHexString(aChunk.getMemoryAddress()) + "\n"); if (SimpleMemoryAllocatorImpl.trackReferenceCounts()) { List<RefCountChangeInfo> history = SimpleMemoryAllocatorImpl.getRefCountInfo(aChunk.getMemoryAddress()); if (history != null) {
/** * Note if v might be an off-heap reference that you did not retain for this EntryEventImpl * then call retainsAndSetOldValue instead of this method. * @param v the caller should have already retained this off-heap reference. */ @Released(ENTRY_EVENT_OLD_VALUE) private void basicSetOldValue(@Unretained(ENTRY_EVENT_OLD_VALUE) Object v) { @Released final Object curOldValue = this.oldValue; if (v == curOldValue) return; if (this.offHeapOk) { if (curOldValue instanceof Chunk) { if (SimpleMemoryAllocatorImpl.trackReferenceCounts()) { OffHeapHelper.releaseAndTrackOwner(curOldValue, new OldValueOwner()); } else { OffHeapHelper.release(curOldValue); } } } this.oldValue = v; }
@Released(ENTRY_EVENT_OLD_VALUE) private void retainAndSetOldValue(@Retained(ENTRY_EVENT_OLD_VALUE) Object v) { if (v == this.oldValue) return; if (v instanceof Chunk) { if (SimpleMemoryAllocatorImpl.trackReferenceCounts()) { SimpleMemoryAllocatorImpl.setReferenceCountOwner(new OldValueOwner()); boolean couldNotRetain = (!((Chunk) v).retain()); SimpleMemoryAllocatorImpl.setReferenceCountOwner(null); if (couldNotRetain) { this.oldValue = null; return; } } else { if (!((Chunk) v).retain()) { this.oldValue = null; return; } } } basicSetOldValue(v); }
/** * This copies the off-heap new and/or old value to the heap. * As a result the current off-heap new/old will be released. * @throws IllegalStateException if called with an event for gfxd data. */ @Released({ENTRY_EVENT_NEW_VALUE, ENTRY_EVENT_OLD_VALUE}) public final void copyOffHeapToHeap() { Object ov = basicGetOldValue(); if (ov instanceof Chunk) { if (SimpleMemoryAllocatorImpl.trackReferenceCounts()) { SimpleMemoryAllocatorImpl.setReferenceCountOwner(new OldValueOwner()); this.oldValue = OffHeapHelper.copyAndReleaseIfNeeded(ov); SimpleMemoryAllocatorImpl.setReferenceCountOwner(null); } else { this.oldValue = OffHeapHelper.copyAndReleaseIfNeeded(ov); } } Object nv = basicGetNewValue(); if (nv instanceof Chunk) { SimpleMemoryAllocatorImpl.setReferenceCountOwner(this); this.newValue = OffHeapHelper.copyAndReleaseIfNeeded(nv); SimpleMemoryAllocatorImpl.setReferenceCountOwner(null); } if (this.newValue instanceof Chunk || this.oldValue instanceof Chunk) { throw new IllegalStateException("event's old/new value still off-heap after calling copyOffHeapToHeap"); } this.offHeapOk = false; }
if (SimpleMemoryAllocatorImpl.trackReferenceCounts()) { SimpleMemoryAllocatorImpl.setReferenceCountOwner(new OldValueOwner()); ((Chunk) ov).release();
) { @Retained Object ov; if (SimpleMemoryAllocatorImpl.trackReferenceCounts()) { SimpleMemoryAllocatorImpl.setReferenceCountOwner(new OldValueOwner()); if (GemFireCacheImpl.gfxdSystem()) {