[ 
https://issues.apache.org/jira/browse/LUCENE-3409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael McCandless updated LUCENE-3409:
---------------------------------------

    Affects Version/s: 4.0
        Fix Version/s: 4.0
                       3.4

I found the issue: we are failing to drop pool'd readers in IW.deleteAll.  I'll 
commit fix shortly.

> NRT reader/writer over RAMDirectory memory leak
> -----------------------------------------------
>
>                 Key: LUCENE-3409
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3409
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.0.2, 3.3, 4.0
>            Reporter: tal steier
>            Assignee: Michael McCandless
>             Fix For: 3.4, 4.0
>
>
> with NRT reader/writer, emptying an index using:
> writer.deleteAll()
> writer.commit()
> doesn't release all allocated memory.
> for example the following code will generate a memory leak:
> /**
>        * Reveals a memory leak in NRT reader/writer<br>
>        * 
>        * The following main() does 10K cycles of:
>        * <ul>
>        * <li>Add 10K empty documents to index writer</li>
>        * <li>commit()</li>
>        * <li>open NRT reader over the writer, and immediately close it</li>
>        * <li>delete all documents from the writer</li>
>        * <li>commit changes to the writer</li>
>        * </ul>
>        * 
>        * Running with -Xmx256M results in an OOME after ~2600 cycles
>        */
>       public static void main(String[] args) throws Exception {
>               RAMDirectory d = new RAMDirectory();
>               IndexWriter w = new IndexWriter(d, new 
> IndexWriterConfig(Version.LUCENE_33, new KeywordAnalyzer()));
>               Document doc = new Document();
>               
>               for(int i = 0; i < 10000; i++) {
>                       for(int j = 0; j < 10000; ++j) {
>                               w.addDocument(doc);
>                       }
>                       w.commit();
>                       IndexReader.open(w, true).close();
>                       w.deleteAll();
>                       w.commit();
>               }
>               
>               w.close();
>               d.close();
>       }       

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to