lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terence Lai <>
Subject RE: Re: Re: OutOfMemoryError
Date Thu, 19 Aug 2004 01:39:08 GMT
Hi David,

In my test program, I invoke the IndexSearcher.close() method at the end of the loop. However,
it doesn't seems to release the memory. My concern is that even though I put the IndexSearcher.close()
statement in the hook methods, it may not release all the memory until the application server
is shut down. Every time the EJB object is re-actived, a new IndexSearcher is open. If the
resources allocated to the previous IndexSearcher cannot be fully released, the system will
use up more memory. Eventually, it may run into the OutOfMemoryError.

I am not very familiar with EJB. My interpretation could be wrong. I am going to try the hook
methods. Thanks for pointing this out to me.


> > I tried to reuse the IndexSearcher, but I have another question. What
> > happen if an application server unloads the class after it is idle for a
> > while, and then re-instantiate the object back when it recieves a new
> > request?
> The EJB spec takes this into account, as there are hook methods you can 
> define that get called when your EJB object is about to be passivated or 
> activated.  Search for something like passivate/active and/or 
> ejbLoad/ejbSave.  This is where you should close/open your single index 
> searcher object.
> -- 
> Cheers,
> David
> This message is intended only for the named recipient.  If you are not the 
> intended recipient you are notified that disclosing, copying, distributing 
> or taking any action  in reliance on the contents of this information is 
> strictly prohibited.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Get your free email account from
          Your Internet Virtual Desktop!

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

View raw message