RE: Re: Re: OutOfMemoryError

2004-08-19 Thread Otis Gospodnetic
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

RE: Re: OutOfMemoryError

2004-08-19 Thread Otis Gospodnetic
Use the life-cycle hooks mentioned in another email (activate/passivate) and when you detect that the server is about to unload your class, call close() on IndexSearcher. I haven't used Lucene in an EJB environment, so I don't know the details, unfortunately. :( Your simulation may be too fast

RE: Re: OutOfMemoryError

2004-08-19 Thread Otis Gospodnetic
Terence, 2) I have a background process to update the index files. If I keep the IndexSearcher opened, I am not sure whether it will pick up the changes from the index updates done in the background process. This is a frequently asked question. Basically, you have to make use of

RE: Re: OutOfMemoryError

2004-08-18 Thread Terence Lai
Hi Otis, The reason why I ran into this problem is that I partition my search documents into multiple index directories ordered by document modified date. My application only returns the lastest 500 documents that matches the criteria. By partitioning the documents into different directories,

RE: Re: OutOfMemoryError

2004-08-18 Thread Terence Lai
Hi, 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? Everytime the server re-instantiates the class, a new IndexSearcher

Re: Re: OutOfMemoryError

2004-08-18 Thread David Sitsky
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

RE: Re: Re: OutOfMemoryError

2004-08-18 Thread Terence Lai
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

RE: Re: OutOfMemoryError

2004-08-17 Thread Terence Lai
Thanks for pointing this out. Even I fixed the code to close the fsDir and also add the ex.printStackTrace(System.out), I am still hitting the OutOfMemeoryError. Terence On Wednesday 18 August 2004 00:30, Terence Lai wrote: if (fsDir != null) { try { is.close();