public synchronized void free(RegularFile file, int count) {
    int remainingCacheSpace = maxCachedBlockCount - blockCache.blockCount();
    if (remainingCacheSpace > 0) {
      file.copyBlocksTo(blockCache, Math.min(count, remainingCacheSpace));
    }
    file.truncateBlocks(file.blockCount() - count);

    allocatedBlockCount -= count;
  }
Frees the last {@code count} blocks from the given file.
jimfs/src/main/java/com/google/common/jimfs/HeapDisk.java