You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2010/05/24 20:46:20 UTC

svn commit: r947759 - /lucene/lucene.net/trunk/C#/src/Lucene.Net/Util/CloseableThreadLocal.cs

Author: digy
Date: Mon May 24 18:46:19 2010
New Revision: 947759

URL: http://svn.apache.org/viewvc?rev=947759&view=rev
Log:
 LUCENENET-358 CloseableThreadLocal memory leak in LocalDataStoreSlot (with workaround)

Modified:
    lucene/lucene.net/trunk/C#/src/Lucene.Net/Util/CloseableThreadLocal.cs

Modified: lucene/lucene.net/trunk/C#/src/Lucene.Net/Util/CloseableThreadLocal.cs
URL: http://svn.apache.org/viewvc/lucene/lucene.net/trunk/C%23/src/Lucene.Net/Util/CloseableThreadLocal.cs?rev=947759&r1=947758&r2=947759&view=diff
==============================================================================
--- lucene/lucene.net/trunk/C#/src/Lucene.Net/Util/CloseableThreadLocal.cs (original)
+++ lucene/lucene.net/trunk/C#/src/Lucene.Net/Util/CloseableThreadLocal.cs Mon May 24 18:46:19 2010
@@ -45,7 +45,7 @@ namespace Lucene.Net.Util
 	{
 		
 		[ThreadStatic]
-		static System.Collections.Generic.Dictionary<object, object> slots;
+        static SupportClass.WeakHashTable slots;
 		
 		public /*protected internal*/ virtual System.Object InitialValue()
 		{
@@ -65,9 +65,9 @@ namespace Lucene.Net.Util
                 return value;
             }
 
-            if (slots.TryGetValue(this, out value))
+            if (slots.ContainsKey(this))
             {
-                return value;
+                return slots[this];
             }
             else
             {
@@ -79,8 +79,8 @@ namespace Lucene.Net.Util
 		
 		public virtual void  Set(System.Object object_Renamed)
 		{
-			if (slots == null)
-				slots = new System.Collections.Generic.Dictionary<object, object>();
+            if (slots == null)
+                slots = new SupportClass.WeakHashTable();
 
 			slots[this] = object_Renamed;	
 		}