If you have many gigabytes of allocatable memory (ie., I have 32g ram, 8g is allocatable), and only a few files (say, 2), this line of code produces a negative number due to integer overflow, which incorrectly turns off buffering:
https://github.com/samtools/htsjdk/blob/master/src/main/java/htsjdk/samtools/util/SortingCollection.java#L538