Add test for string interning OOM.
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 5 Nov 2010 22:01:53 +0000 (20:01 -0200)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 10 Nov 2010 19:35:51 +0000 (17:35 -0200)
mono/tests/gc-oom-handling2.cs

index 5b3cbf73aaf4c3a7a3f2be4df9b8a2f7a6af2fbf..0a38190e820523215f9128101f20b9cba09cfcb3 100644 (file)
@@ -2,18 +2,27 @@ using System;
 using System.Collections.Generic;
 
 class Driver {
+       static void DumpStuff () {
+               Console.WriteLine ("CWL under OOM - should not print {0}", 99);
+               Console.WriteLine ("CWL under OOM - should not print {0}{1}", 22, 44.4);
+       }
+
        static int Main () {
                Console.WriteLine ("start");
                var r = new Random (123456);
                var l = new List<object> ();
                try {
-                       for (int i = 0; i < 40000; ++i) {
+                       for (int i = 0; i < 400000; ++i) {
                                var foo = new byte[r.Next () % 4000];
                                l.Add (foo);
                        }
                        Console.WriteLine ("done");
                        return -1;
-               } catch (Exception e) {
+               } catch (Exception) {
+                       try {
+                               DumpStuff ();
+                       } catch (Exception) {}
+
                        l.Clear ();
                        l = null;
                        Console.WriteLine ("OOM done");