The code in MemoClosure.ProgressiveIterator.materialize() does this:
which is clearly wrong because the reservoir may contain unused entries, even if condense() has been called. Although we don't have a test case to prove it, there is circumstantial evidence that this is resulting in count() returning 50 (the initial size of the reservoir) when applied to a sequence which is actually shorter than 50.
The code should be the same as in MemoClosure.materialize(), namely
new SequenceExtent(reservoir, 0, used)
Oddly the incorrect code is present in 9.4 as well as 9.5 but there is no evidence that it has ever caused any problems. However, it is so obviously wrong that I am going to patch it for both releases.
Please register to edit this issue