code: private long freeMemory() {
      updatePeakMemoryUsed();
      long memoryFreed = 0;
      for (MemoryBlock block : allocatedPages) {
        memoryFreed += block.size();
        freePage(block);
      }
      allocatedPages.clear();
      currentPage = null;
      pageCursor = 0;
      return memoryFreed;
    }
docs: Free this sorter's data pages.
  
  @return the number of bytes freed.