@Override
  public synchronized int size() throws IOException {
    checkNotClosed();
    //FIXME RC: it is O(#segments) now, but O(1) would be better -> just keep recordsCount in a header
    int segmentSize = header.segmentSize();
    int segmentsCount = header.actualSegmentsCount();
    int totalEntries = 0;
    for (int segmentIndex = 1; segmentIndex <= segmentsCount; segmentIndex++) {
      totalEntries += HashMapSegmentLayout.aliveEntriesCount(bufferSource, segmentIndex, segmentSize);
    }
    return totalEntries;
  }
@Override
  public synchronized int size()