PeterOeClausen opened a new issue, #784:
URL: https://github.com/apache/lucenenet/issues/784

   I'm running the latest Lucene .NET versions:
   Lucene.Net 4.8.0-beta00016
   Lucene.Net.Analysis.Common 4.8.0-beta00016
   
   I'm doing the following:
   ```cs
               using var analyzer = new KeywordAnalyzer();
               using var directory = FSDirectory.Open(IndexPath);
               var config = new IndexWriterConfig(LuceneVersion, analyzer)
               {
                   OpenMode = OpenMode.CREATE, // Use OpenMode.CREATE to 
overwrite, or OpenMode.APPEND to just open
                   RAMPerThreadHardLimitMB = 100,
                   RAMBufferSizeMB = 100,
               };
               using var writer = new IndexWriter(directory, config);
               
               // Write index to disk
               writer.AddDocuments(productDocuments);
               writer.AddDocuments(productCategoryDocuments);
               writer.AddDocuments(productTypeDocuments);
               writer.AddDocuments(productLineDocuments);
               writer.Commit();
   ```
   
   As soon as writer.AddDocuments() is called, the memory consumption grows a 
lot.
   You can see the sudden increase in the Diagnostic Tool in visual studio: 
   
![image](https://user-images.githubusercontent.com/6975621/208420492-6c9d779d-1991-4a0c-9819-eaefea00919b.png)
   
   Running it multiple times keeps increasing the memory usage up to 3GB, at 
which point it doesn't grow any longer. And these 3GB are never released again. 
The program doesn't crash, and it stops acquiring memory.
   
   I want to limit how much memory Lucene can use, but using `RAMBufferSizeMB` 
and `RAMPerThreadHardLimitMB` seems to have no effect at all.
   
   I tried flushing as well, which had no effect, and I tried calling Dispose() 
which also had no effect.
   
   I've also tried setting MaxBufferedDocs to 1000, still no limit to RAM usage.
   
   Have I missed something in the documentation? Is there a way to limit RAM 
usage of the Lucene .NET IndexWriter?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to