Details

Type: Bug

Status: Closed

Priority: Major

Resolution: Fixed

Affects Version/s: 3.6, 4.0ALPHA

Component/s: modules/spellchecker

Labels:None

Lucene Fields:New, Patch Available
Description
The Sorter we use for offline sorting seems to use the MIN_BUFFER_SIZE as a upper bound even if there is more memory available. See this snippet:
long half = free/2; if (half >= ABSOLUTE_MIN_SORT_BUFFER_SIZE) { return new BufferSize(Math.min(MIN_BUFFER_SIZE_MB * MB, half)); } // by max mem (heap will grow) half = (max  total) / 2; return new BufferSize(Math.min(MIN_BUFFER_SIZE_MB * MB, half));
use use use Math.max instead of min here.
It's a bug, don't know if it was a regression when we talked about how to estimate "half available heap" or if it was there even before then, but it should be Math.max().
Should we check for max array size overflows (for folks with superlarge heaps)?