Re: simple question about decRef

2013-06-01 Thread Michael McCandless
Only call decRef if you previously called incRef.  They must match one for one.

Also, call close when you are done using the IndexReader.

If you fail to decRef or close then files will be held open and you'll
eventually exhaust the limit of open file descriptors.

Mike McCandless

http://blog.mikemccandless.com


On Fri, May 31, 2013 at 8:12 PM, Yonghui Zhao  wrote:
> After we use IndexReader do we always need call decRef explicitly?
>
> What will happen, if I don't call decRef? Thanks
>
> Sent from my iPad
>
> -
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>

-
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



Re: simple question about decRef

2013-06-01 Thread Yonghui Zhao
Thanks, Michael.

My understanding is that close also calls decRef.  So if I never call
incRef, I also can call decRef one time, the decRef actually close the
reader since the ref counter is decreased to 0.

So  if we call incRef n times, can I call decRef  n+1 times to close the
reader without call close, since I don't know when the ref counter is 1?






2013/6/2 Michael McCandless 

> Only call decRef if you previously called incRef.  They must match one for
> one.
>
> Also, call close when you are done using the IndexReader.
>
> If you fail to decRef or close then files will be held open and you'll
> eventually exhaust the limit of open file descriptors.
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
> On Fri, May 31, 2013 at 8:12 PM, Yonghui Zhao 
> wrote:
> > After we use IndexReader do we always need call decRef explicitly?
> >
> > What will happen, if I don't call decRef? Thanks
> >
> > Sent from my iPad
> >
> > -
> > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> > For additional commands, e-mail: java-user-h...@lucene.apache.org
> >
>
> -
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>