mirror of https://github.com/apache/lucene.git
LUCENE-4995: Don't hold references on large decompression buffers in CompressingStoredFieldsReader.
CompressingStoredFieldsReader now only reuses an internal buffer when there is no more than 32kb to decompress. For large blocks, a dedicated decompression buffer will be created on demand. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1491374 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d35702de9a
commit
e78908ad8c
|
@ -60,6 +60,9 @@ import org.apache.lucene.util.packed.PackedInts;
|
|||
*/
|
||||
public final class CompressingStoredFieldsReader extends StoredFieldsReader {
|
||||
|
||||
// Do not reuse the decompression buffer when there is more than 32kb to decompress
|
||||
private static final int BUFFER_REUSE_THRESHOLD = 1 << 15;
|
||||
|
||||
private final FieldInfos fieldInfos;
|
||||
private final CompressingStoredFieldsIndexReader indexReader;
|
||||
private final IndexInput fieldsStream;
|
||||
|
@ -255,6 +258,7 @@ public final class CompressingStoredFieldsReader extends StoredFieldsReader {
|
|||
return;
|
||||
}
|
||||
|
||||
final BytesRef bytes = totalLength <= BUFFER_REUSE_THRESHOLD ? this.bytes : new BytesRef();
|
||||
decompressor.decompress(fieldsStream, totalLength, offset, length, bytes);
|
||||
assert bytes.length == length;
|
||||
|
||||
|
|
Loading…
Reference in New Issue