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 2009/12/07 20:08:12 UTC

svn commit: r888087 - /incubator/lucene.net/trunk/C#/src/Test/TestSupportClass.cs

Author: digy
Date: Mon Dec  7 19:08:11 2009
New Revision: 888087

URL: http://svn.apache.org/viewvc?rev=888087&view=rev
Log:
Some Corrections to TestWeakHashTable.B_TestOutOfMemory

Modified:
    incubator/lucene.net/trunk/C#/src/Test/TestSupportClass.cs

Modified: incubator/lucene.net/trunk/C#/src/Test/TestSupportClass.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/TestSupportClass.cs?rev=888087&r1=888086&r2=888087&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/TestSupportClass.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/TestSupportClass.cs Mon Dec  7 19:08:11 2009
@@ -145,11 +145,26 @@
         [Test]
         public void B_TestOutOfMemory()
         {
-            IDictionary wht = TestWeakHashTableBehavior.CreateDictionary(); //new SupportClass.TjWeakHashTable();
+            IDictionary wht = TestWeakHashTableBehavior.CreateDictionary(); 
+            int OOMECount = 0;
 
-            for (int i = 0; i < 1024 * 8 + 32; i++) // requested Mem. > 8GB
+            for (int i = 0; i < 1024 * 24 + 32; i++) // total requested Mem. > 24GB
             {
-                wht.Add(new BigObject(i), i);
+                try
+                {
+                    wht.Add(new BigObject(i), i);
+                    if(i%1024==0) Console.WriteLine("Requested Mem: " + i.ToString() + " MB");
+                    OOMECount = 0;
+                }
+                catch (OutOfMemoryException oom)
+                {
+                    if (OOMECount++ > 10) throw new Exception("Memory Allocation Error in B_TestOutOfMemory");
+                    //Try Again. GC will eventually release some memory.
+                    Console.WriteLine("OOME WHEN i=" + i.ToString() + ". Try Again");
+                    System.Threading.Thread.Sleep(10);
+                    i--;
+                    continue;
+                }
             }
 
             GC.Collect();