@Unretained
  @Retained
  Object addressToObject(@Released @Retained long ohAddress, boolean decompress,
      RegionEntryContext context) {
    if (isOffHeap(ohAddress)) {
      @Unretained
      OffHeapStoredObject chunk = offHeapStoredObjectFactory.apply(ohAddress);
      @Unretained
      Object result = chunk;
      if (decompress && chunk.isCompressed()) {
        try {
          // to fix bug 47982 need to:
          byte[] decompressedBytes = chunk.getDecompressedBytes(context);
          if (chunk.isSerialized()) {
            // return a VMCachedDeserializable with the decompressed serialized bytes since chunk is
            // serialized
            result = CachedDeserializableFactory.create(decompressedBytes, context.getCache());
          } else {
            // return a byte[] since chunk is not serialized
            result = decompressedBytes;
          }
        } finally {
          // Decompress is only true when this method is called by _getValueRetain. In that case the
          // caller has already retained ohAddress because it thought we would return it. But we
          // have unwrapped it and are returning the decompressed results. So we need to release the
          // chunk here.
          chunk.release();
        }
      }
      return result;
    }

    if ((ohAddress & ENCODED_BIT) != 0) {
      TinyStoredObject daa = new TinyStoredObject(ohAddress);
      Object result = daa;
      if (decompress && daa.isCompressed()) {
        byte[] decompressedBytes = daa.getDecompressedBytes(context);
        if (daa.isSerialized()) {
          // return a VMCachedDeserializable with the decompressed serialized bytes since daa is
          // serialized
          result = CachedDeserializableFactory.create(decompressedBytes, context.getCache());
        } else {
          // return a byte[] since daa is not serialized
          result = decompressedBytes;
        }
      }
      return result;
    }

    return TokenAddress.ADDRESS_TO_OBJECT[(int) ohAddress >> 1];
  }
This method may release the object stored at ohAddress if the result needs to be decompressed
and the decompress parameter is true. This decompressed result will be on the heap.

@param ohAddress OFF_HEAP_ADDRESS
@param decompress true if off-heap value should be decompressed before returning
@param context used for decompression
@return OFF_HEAP_OBJECT (sometimes)
geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapRegionEntryHelperInstance.java