code: @Override
    public synchronized void relocate(int oldPosition, int newPosition, ByteBuffer oldBuffer, ByteBuffer newBuffer)
    {
      UpdateDoublesSketch sketch = sketches.get(oldBuffer).get(oldPosition);
      final WritableMemory oldRegion = getMemory(oldBuffer).writableRegion(oldPosition, maxIntermediateSize);
      if (sketch.isSameResource(oldRegion)) { // sketch was not relocated on heap
        final WritableMemory newRegion = getMemory(newBuffer).writableRegion(newPosition, maxIntermediateSize);
        sketch = UpdateDoublesSketch.wrap(newRegion);
      }
      putSketch(newBuffer, newPosition, sketch);
  
      final Int2ObjectMap<UpdateDoublesSketch> map = sketches.get(oldBuffer);
      map.remove(oldPosition);
      if (map.isEmpty()) {
        sketches.remove(oldBuffer);
        memCache.remove(oldBuffer);
      }
    }
docs: In that case we need to reuse the object from the cache as opposed to wrapping the new buffer.