PeterOeClausen commented on issue #784:
URL: https://github.com/apache/lucenenet/issues/784#issuecomment-1359096876

   Thanks for the response.
   Calling `GC.Collect()` doesn't help either.
   Loading the data, and creating the 54326 documents does not increase memory 
usage significantly. Memory jumps when I add the documents using either 
`writer.AddDocuments(docs);` or `writer.AddDocument(doc);`
   I've even tried creating a seperate method:
   ```cs
           private void 
WriteDocuments(IEnumerable<IEnumerable<IIndexableField>> docs)
           {
               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
                   RAMBufferSizeMB = 100,
                   RAMPerThreadHardLimitMB = 100,
               };
   
               using var writer = new IndexWriter(directory, config);
               foreach (var doc in docs)
               {
                   writer.AddDocument(doc);
               }
               writer.Commit();
               writer.Dispose();
               directory.Dispose();
               analyzer.Dispose();
           }
   ```
   And calling `GC.Collect()` afterwards - no effect.
   
   We're currently running this in a Singleton service in an Umbraco 10 project 
- both the Umbraco project, and the project the search is in targets `net6.0`. 
We are not using `.NET Standard 2.0` - but we have no global variables.
   
   Also we're using `LuceneVersion.LUCENE_48`.
   
   I think the next thing I want to try out is running it in a Console App, 
outside of Umbraco, and see how memory behaves with 54326 documents with 
similar search fields.
   
   I'll write again on what I'll find.
   
   It seems weird to me that the NuGet package is so popular (18,671,634 total 
downloads) - yet I couldn't find anyone else reporting on memory issues... It 
might be our setup - will investigate :-)


-- 
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

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

Reply via email to