lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r934965 - in /lucene/lucene.net/trunk/C#/src/Lucene.Net: Analysis/Tokenizer.cs Index/DocInverterPerField.cs
Date Fri, 16 Apr 2010 15:36:00 GMT
Author: digy
Date: Fri Apr 16 15:36:00 2010
New Revision: 934965

URL: http://svn.apache.org/viewvc?rev=934965&view=rev
Log:
LUCENENET-355  [LUCENE-2387] IndexWriter retains references to Readers used in Fields (memory
leak)

Modified:
    lucene/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Tokenizer.cs
    lucene/lucene.net/trunk/C#/src/Lucene.Net/Index/DocInverterPerField.cs

Modified: lucene/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Tokenizer.cs
URL: http://svn.apache.org/viewvc/lucene/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/Tokenizer.cs?rev=934965&r1=934964&r2=934965&view=diff
==============================================================================
--- lucene/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Tokenizer.cs (original)
+++ lucene/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Tokenizer.cs Fri Apr 16 15:36:00 2010
@@ -73,7 +73,13 @@ namespace Lucene.Net.Analysis
 		/// <summary>By default, closes the input Reader. </summary>
 		public override void  Close()
 		{
-			input.Close();
+            if (input != null) {
+                input.Close();
+                // LUCENE-2387: don't hold onto Reader after close, so
+                // GC can reclaim
+                input = null;
+            }
+
 		}
   
 		/// <summary>Return the corrected offset. If {@link #input} is a {@link CharStream}
subclass

Modified: lucene/lucene.net/trunk/C#/src/Lucene.Net/Index/DocInverterPerField.cs
URL: http://svn.apache.org/viewvc/lucene/lucene.net/trunk/C%23/src/Lucene.Net/Index/DocInverterPerField.cs?rev=934965&r1=934964&r2=934965&view=diff
==============================================================================
--- lucene/lucene.net/trunk/C#/src/Lucene.Net/Index/DocInverterPerField.cs (original)
+++ lucene/lucene.net/trunk/C#/src/Lucene.Net/Index/DocInverterPerField.cs Fri Apr 16 15:36:00
2010
@@ -227,6 +227,10 @@ namespace Lucene.Net.Index
 						fieldState.offset += docState.analyzer.GetOffsetGap(field);
 					fieldState.boost *= field.GetBoost();
 				}
+                
+                // LUCENE-2387: don't hang onto the field, so GC can
+                // reclaim
+                fields[i] = null;
 			}
 			
 			consumer.Finish();



Mime
View raw message