lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Shaw" <>
Subject Re: Possible leaks in SegmentReader and TermInfosReader
Date Thu, 29 Mar 2007 19:20:15 GMT

On 3/29/07, Vova Tymchenko <> wrote:
> The trouble that I see with SegmentReader (and TermInfosReader as well) is that it stores
> to TermVectorsReader in ThreadLocalStore when GetTermVectorsReader is called, but .Close
method fails
> to close and clean up that reference.

I believe the idea here (at least for TermInfosReader) is to cache
that object so that multiple searches on the same thread do not have
to continuously reopen the term info file, which can be a pretty big
performance hit.  Removing the reference in DoClose() will effectively
undo this optimization.

I think that the references to the data stored in the ThreadLocalStore
will be GCable once the thread containing it dies.

There was a recent thread about this on the java-dev list, in which
someone thought that ThreadLocals were causing a leak, but it turned
out to be a bug in the user's code:


View raw message