lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trevor Watson <powersearchsoftw...@gmail.com>
Subject [Lucene.Net] Memory Leak in 2.9.2.2
Date Tue, 29 Nov 2011 01:59:08 GMT
I'm attempting to use Lucene.Net v2.9.2.2 in a Visual Studio 2005 (.NET
2.0) environment.  We had a piece of software that WAS working.  I'm not
sure what has changed however, the following code results in a memory leak
in the Lucene.Net component (or a failure to clean up used memory).

The code in issue is here:

 private void SaveFileToFileInfo(Lucene.Net.Index.IndexWriter iw, bool
delayCommit, string sDataPath)
{
   Document doc = getFileInfoDoc(sDataPath);
   Analyzer analyzer = clsLuceneFunctions.getAnalyzer();
   if (this.FileID == 0)
   {
      string s = "";
   }
   iw.UpdateDocument(new Lucene.Net.Index.Term("FileId",
this.fileID.ToString("000000000")), doc, analyzer);

   analyzer = null;
   doc = null;
   if (!delayCommit)
                iw.Commit();
}

Commenting out the line iw.UpdateDocument resulted in no memory increase.
I also tried replacing it with a deleteDocument and  AddDocument and the
memory increased the same as using the UpdateDocument function

The getAnalyzer() function returns a ExtendedStandardAnalyzer, but it's the
UpdateDocument line specifically that gives me the issue.

Any assistance would be greatly appreciated.

Trevor Watson

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message