lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject RE: Re: Re: OutOfMemoryError
Date Thu, 19 Aug 2004 11:14:31 GMT
Terence,

Calling close() on IndexSearcher will not release the memory
immediately.  It will only release resources (e.g. other Java objects
used by IndexSearcher), and it is up to the JVM's garbage collector to
actually reclaim/release the previously used memory.  There are
command-line parameters you can use to tune garbage collection.  Here
is one example:

java -XX:+UseParallelGC -XX:PermSize=20M -XX:MaxNewSize=32M
-XX:NewSize=32M .....

This works with Sun's JVM.  The above is just an example - you need to
play with the options and see what works for you.  There are other
options, too:

    -Xnoclassgc       disable class garbage collection
    -Xincgc           enable incremental garbage collection
    -Xloggc:<file>    log GC status to a file with time stamps
    -Xbatch           disable background compilation
    -Xms<size>        set initial Java heap size
    -Xmx<size>        set maximum Java heap size
    -Xss<size>        set java thread stack size
    -Xprof            output cpu profiling data
    -Xrunhprof[:help]|[:<option>=<value>, ...]
                      perform JVMPI heap, cpu, or monitor profiling


Otis



--- Terence Lai <tlai@trekspace.com> wrote:

> 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.
> 
> Terence
> 
> > > 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: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> > 
> 
> 
> 
> 
> ----------------------------------------------------------
> Get your free email account from http://www.trekspace.com
>           Your Internet Virtual Desktop!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message