You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by Trevor Watson <po...@gmail.com> on 2011/11/29 18:16:47 UTC

[Lucene.Net] Re: Memory Leak in code (mine or Lucene?) 2.9.2.2

I don't recall seeing a close function on the analyzer.  But I will
definitely take a look. Thanks!

On Tuesday, November 29, 2011, Oren Eini (Ayende Rahien) <ay...@ayende.com>
wrote:
> You need to close the analyzer.
>
> On Tue, Nov 29, 2011 at 12:32 AM, Trevor Watson <
> powersearchsoftware@gmail.com> wrote:
>
>> I'm using the following block of code.  The document is created in
another
>> function and written to the Lucene index via an IndexWriter
>>
>> 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();
>>        }
>>
>> When the UpdateDocument line is commented out, everything seems to run
>> fine.  When that line of code is run, it slowly creeps up.  However, it
>> used to work on some computers and now works on 1 or 2, but fails on our
>> client's computers.
>>
>> Is there an issue with UpdateDocument that I am not aware of in 2.9.2.2?
>>
>> Thanks in advance.
>>
>

[Lucene.Net] Re: Memory Leak in code (mine or Lucene?) 2.9.2.2

Posted by Trevor Watson <po...@gmail.com>.
I was wrong, analyzer does have the close function.  I closed my analyzer,
but the steady climb in memory is still there.

I wonder if I should create a global analyzer variable and enclose it in a
lock to make sure there isn't any thread issues and use that instead.
Could it be a leak in the analyzer itself?




On Tue, Nov 29, 2011 at 12:16 PM, Trevor Watson <
powersearchsoftware@gmail.com> wrote:

> I don't recall seeing a close function on the analyzer.  But I will
> definitely take a look. Thanks!
>
>
> On Tuesday, November 29, 2011, Oren Eini (Ayende Rahien) <
> ayende@ayende.com> wrote:
> > You need to close the analyzer.
> >
> > On Tue, Nov 29, 2011 at 12:32 AM, Trevor Watson <
> > powersearchsoftware@gmail.com> wrote:
> >
> >> I'm using the following block of code.  The document is created in
> another
> >> function and written to the Lucene index via an IndexWriter
> >>
> >> 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();
> >>        }
> >>
> >> When the UpdateDocument line is commented out, everything seems to run
> >> fine.  When that line of code is run, it slowly creeps up.  However, it
> >> used to work on some computers and now works on 1 or 2, but fails on our
> >> client's computers.
> >>
> >> Is there an issue with UpdateDocument that I am not aware of in 2.9.2.2?
> >>
> >> Thanks in advance.
> >>
> >
>