On Sat, Aug 6, 2011 at 1:35 PM, Paul Libbrecht <p...@hoplahup.net> wrote:
>
> Le 6 août 2011 à 17:37, Yonik Seeley a écrit :
>>> I have a custom query-handler and a custom response writer.
>>
>> Do you always retrieve the searcher via
>> SolrQueryRequest.getSearcher()?  If so, there should be no problem...
>> but if you call SolrCore.getSearcher(), that is where leaks can happen
>> if you don't decref the reference returned.
>
> I've been using the following:
>
>   rb.req.getCore().getSearcher().get().getReader()

Bingo!  Code should never do core.getSearcher().get()
since core.getSearcher returns a reference that must be decremented
when you are done.

Using req.getSearcher() is much easier since it ensures that the
searcher never changes during the scope of a single request
and it handles decrementing the reference when the request is closed.

-Yonik
http://www.lucidimagination.com

Reply via email to