private void buildSortedReadEndLists() {
final int maxInMemory = (int) ((Runtime.getRuntime().maxMemory() * SORTING_COLLECTION_SIZE_RATIO) / ReadEndsForMarkDuplicates.SIZE_OF);
log.info("Will retain up to " + maxInMemory + " data points before spilling to disk.");
this.pairSort = SortingCollection.newInstance(ReadEndsForMarkDuplicates.class,
new ReadEndsForMarkDuplicatesCodec(),
new ReadEndsMDComparator(),
maxInMemory,
TMP_DIR);
this.fragSort = SortingCollection.newInstance(ReadEndsForMarkDuplicates.class,
new ReadEndsForMarkDuplicatesCodec(),
new ReadEndsMDComparator(),
maxInMemory,
TMP_DIR);
final SamHeaderAndIterator headerAndIterator = openInputs();