Ok I understand the code better now – the scores array keeps scores only for docs that were visited by Scorer. Therefore it doesn't need to be of size maxDoc, but rather close to how many docs were visited.
Makes sense I guess for queries that hit a low percentage of the index. I'm not worried about the re-allocation work at all ... I didn't dig deep into the code first, and thought that we're keeping an entry per document in the index, whether it's scored or not.
The current code is good then.
I'll review the new patch now.