@Test
  public void copyIfNeededWithOffHeapDeserializedObjDoesNotRelease() {
    allocateOffHeapDeserialized();
    int initialRefCountOfObject = storedObject.getRefCount();
    OffHeapHelper.copyIfNeeded(storedObject, null);
    assertThat("Ref count after copy", storedObject.getRefCount(), is(initialRefCountOfObject));
  }
Extracted from JUnit setUp() to reduce test overhead for cases where offheap memory isn't
needed.
geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapHelperJUnitTest.java