lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Newson (JIRA)" <>
Subject [jira] Commented: (LUCENE-1326) Inflater.end() method not always called in FieldsReader
Date Thu, 03 Jul 2008 18:39:45 GMT


Robert Newson commented on LUCENE-1326:

You're welcome and thanks for the quick response!

By the way, our specific issue was with DeflaterOutputStream.close(). It only calls end()
on the deflater if it created it itself, so this;

dos = new DeflaterOutputStream();
try {
} finally {

frees all resources but this does not;

dos = new DeflaterOutputStream(new Deflater(Deflater.BEST_COMPRESSION, true));
try {
} finally {

You have to call Deflater.end() *yourself* if you make one when you pass it in. close() is
not sufficient.

> Inflater.end() method not always called in FieldsReader
> -------------------------------------------------------
>                 Key: LUCENE-1326
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.3.1
>            Reporter: Robert Newson
> We've just found an insidious memory leak in our own application as we did not always
call Deflater.end() and Inflater.end(). As documented here;
> The non-heap memory that the native zlib code uses is not freed in a timely manner.
> FieldsWriter appears safe as no exception can be thrown between the Deflater's creation
and end() as it uses a ByteArrayOutputStream
> FieldsReader, however, is not safe. In the event of a DataFormatException the call to
end() will not occur.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message