http://issues.apache.org/bugzilla/show_bug.cgi?id=30628
you can close the index, but the Garbage Collector still needs to reclaim the memory and it may be taking longer than your loop to do so.
John
JiÅÃ Kuhn wrote:
I disagree or I don't understand.
I can change the code as it is shown below. Now I must reopen the index to see the changes, but the memory problem remains. I realy don't know what I'm doing wrong, the code is so simple.
Jiri.
...
public static void main(String[] args) throws IOException { Directory directory = create_index();
for (int i = 1; i < 100; i++) { System.err.println("loop " + i + ", index version: " + IndexReader.getCurrentVersion(directory)); search_index(directory); add_to_index(directory, i); } }
private static void add_to_index(Directory directory, int i) throws IOException { IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(), false);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Document doc = new Document();
doc.add(Field.Keyword("date", df.format(new Date(System.currentTimeMillis())))); doc.add(Field.Keyword("id", "CD" + String.valueOf(i))); doc.add(Field.Text("text", "Tohle neni text " + i)); writer.addDocument(doc);
System.err.println("index size: " + writer.docCount()); writer.close(); }
...
-----Original Message----- From: John Moylan [mailto:[EMAIL PROTECTED] Sent: Monday, September 13, 2004 3:25 PM To: Lucene Users List Subject: Re: OutOfMemory example
You should reuse your old index (as eg an application variable) unless it has changed - use getCurrentVersion to check the index for updates. This has come up before.
John
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
****************************************************************************** The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Please note that emails to, from and within RTÉ may be subject to the Freedom of Information Act 1997 and may be liable to disclosure. ******************************************************************************
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
