If the IndexReader is still holding a reference to the listener in its collection, I don't see how it could be GC'ed. This is a pretty classic memory leak case.
-- Phil On Wed, Aug 20, 2014 at 11:15 AM, Uwe Schindler <[email protected]> wrote: > Yeah, > > > > I dont see the memory leak, too. After you closed the IndexReader its free > for garbage collection. So it should no longer block the listener to be > GCed. > > > > Uwe > > > > ----- > > Uwe Schindler > > H.-H.-Meier-Allee 63, D-28213 Bremen > > http://www.thetaphi.de > > eMail: [email protected] > > > > *From:* Shai Erera [mailto:[email protected]] > *Sent:* Wednesday, August 20, 2014 5:10 PM > *To:* [email protected] > *Subject:* Re: IndexReader.removeReaderClosedListener > > > > I don't understand something -- you add a ReaderClosedListener to get a > notification when IR.close() is called (actually, when it's actually being > closed). Why removing the listener after the reader has been closed? Don't > apps usually nullify their IR member after it's been closed? > > Shai > > > > On Wed, Aug 20, 2014 at 5:51 PM, Phil Herold <[email protected]> wrote: > > Fine. I'm sure you've got a good reason for this. But it is totally > un-intuitive, and introduces a potential memory leak, IMO. The > implementation of this pattern is definitely different than just about any > other library I can think of. > > > > Given that having a listener for index closed doesn't really solve the > issue I was having that I was hoping it would, it doesn't much matter to me > at this point. > > > > Thanks. > > > > -- > > Phil > > > > On Wed, Aug 20, 2014 at 8:37 AM, Robert Muir <[email protected]> wrote: > > I don't agree. Operations like this shouldnt be performed on closed > readers. > > the ensureOpen is correct. > > > On Wed, Aug 20, 2014 at 8:27 AM, Phil Herold <[email protected]> wrote: > > Bingo. ensureOpen() should not be called from this method. Thanks. > > > > -- > > Phil > > > > > > > > On Wed, Aug 20, 2014 at 4:55 AM, Uwe Schindler <[email protected]> wrote: > >> > >> Hi, > >> > >> In my opinion, removing the listener before close looks wrong. Because > you > >> would not get the listener events for the explicit close of the > >> DirectoryReader. > >> > >> I would just remove the ensureOpen(). We should open issue. > >> > >> Uwe > >> ----- > >> Uwe Schindler > >> H.-H.-Meier-Allee 63, D-28213 Bremen > >> http://www.thetaphi.de > >> eMail: [email protected] > >> > >> > >> > -----Original Message----- > >> > From: Michael McCandless [mailto:[email protected]] > >> > Sent: Wednesday, August 20, 2014 9:53 AM > >> > To: Lucene/Solr dev; Phil Herold > >> > Subject: Re: IndexReader.removeReaderClosedListener > >> > > >> > Hmm, you should call this method before closing the IndexReader, to > >> > remove a listener you previously added. > >> > > >> > Mike McCandless > >> > > >> > http://blog.mikemccandless.com > >> > > >> > > >> > On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <[email protected]> > >> > wrote: > >> > > The implementation of this final method (latest 4.9 code) calls > >> > > ensureOpen(), which fails, since the reader is closed. As a result, > >> > > this method doesn't work. It seems as if this is therefore a > potential > >> > > memory leak, not being able to remove the listener. Or am I missing > >> > something? > >> > > > >> > > -- > >> > > Phil > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: [email protected] For > additional > >> > commands, e-mail: [email protected] > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > > >
