@Test
  public void testPersistentCompressorChange() {
    GemFireCacheImpl gfc = createCache(true);
    Region<Object, Object> r = null;
    String value = "value1";
    String key = "key";

    try {
      r = gfc.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT).setOffHeap(true)
          .setCompressor(new SnappyCompressor()).create("region1");
      r.put(key, value);
    } finally {
      closeCache(gfc, false);
    }

    gfc = createCache(true);
    try {
      r = gfc.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT).setOffHeap(true)
          .setCompressor(null).create("region1");
      assertEquals(true, r.containsKey(key));
      MemoryAllocatorImpl mai = MemoryAllocatorImpl.getAllocator();
      List<OffHeapStoredObject> orphans = mai.getLostChunks(gfc);
      if (orphans.size() > 0) {
        fail("expected no orphan detected, but gets orphan size " + orphans.size());
      }
      assertEquals(value, r.get(key));
    } finally {
      if (r != null && !r.isDestroyed()) {
        r.destroyRegion();
      }
      closeCache(gfc, false);
    }
  }
This method retains both ohOldValue and ohNewValue
geode-core/src/integrationTest/java/org/apache/geode/internal/offheap/OffHeapRegionBase.java