lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Parkes" <>
Subject Re: [jira] Commented: (LUCENE-686) Resources not always reclaimed in scorers after each search
Date Wed, 18 Oct 2006 23:44:09 GMT
	The bottom line is:
	>  1) TermDocs has a close method
	>  2) anything implimenting TermDocs should be able to trust
	>     close() will be called
	>  3) anything iterating over a TermDocs should call close()
	> ...ergo: TermScorer needs a close() method, right?

	There is no memory leak now, and TermDocs.close() is not always
	called, so I'd rather conclude that a close() method is not

Seems like the issue here is design integrity.

I'm not even sure what the intended use of close() is on TermDocs. Is it
optional or required? If it's required, implementers of the interface
should be allowed to depend on it being called and any lack of a call is
a latent bug, just waiting for the first TermDocs implementation that
does something in close(). Or it could be optional, perhaps with the
intention that a client might want to call it earlier than the object
will get GCed in order to release resources earlier. Then TermDocs
implementations have to arrange to have resources freed in case close
isn't called, perhaps by having a finalize that calls close a la

Of course, if it never does anything and never will, the method could
just be ditched.

But I'd say it needs to be decided what the proper interpretation is.
The idea that callers will know whether or not to call it (because they
know which concrete class they're using) gives me the heebee jeebees.

Back to design integrity: the issue is it needs to be clear to
everybody. The fact that several people have been looking at this seems
evidence that the current state isn't clear and a change that would keep
others from spending more time on it would be a win.

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

View raw message