private void releaseInitialRefcounts(DiskRangeList current) {
    while (current != null) {
      DiskRangeList toFree = current;
      current = current.next;
      if (toFree instanceof ProcCacheChunk) {
        ProcCacheChunk pcc = (ProcCacheChunk)toFree;
        if (pcc.originalData != null) {
          // TODO: can this still happen? we now clean these up explicitly to avoid other issues.
          // This can only happen in case of failure - we read some data, but didn't decompress
          // it. Deallocate the buffer directly, do not decref.
          if (pcc.getBuffer() != null) {
            cacheWrapper.getAllocator().deallocate(pcc.getBuffer());
          }
          continue;
        }
      }
      if (!(toFree instanceof CacheChunk)) continue;
      CacheChunk cc = (CacheChunk)toFree;
      if (cc.getBuffer() == null) continue;
      MemoryBuffer buffer = cc.getBuffer();
      cacheWrapper.releaseBuffer(buffer);
      cc.setBuffer(null);
    }
  }
Estimate the RowGroup offset given the next RG offset and isLast.

@param isCompressed is the RowGroup compressed
@param isLast is this the last RowGroup
@param nextGroupOffset the offset of the next RowGroup
@param streamLength the length of the whole Stream
@param bufferSize the size of the buffer
@return
ql/src/java/org/apache/hadoop/hive/ql/io/orc/encoded/EncodedReaderImpl.java