@Test
  public void copyAndReleaseWithRetainedDeserializedObjectDecreasesRefCnt() {
    allocateOffHeapDeserialized();
    assertTrue(storedObject.retain());
    assertThat("Retained chunk ref count", storedObject.getRefCount(), is(2));
    OffHeapHelper.copyAndReleaseIfNeeded(storedObject, null);
    assertThat("Chunk ref count decreases", storedObject.getRefCount(), is(1));
  }
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