[interp] disable assemblyresolve_event6.exe
[mono.git] / mono / tests / gc-oom-handling.cs
1 using System;
2 using System.Collections.Generic;
3
4 class Driver {
5         static int Main () {
6                 Console.WriteLine ("start");
7                 var l = new object[40000];
8                 try {
9                         for (int i = 0; i < 40000; ++i) {
10                                 var foo = new byte[2000];
11                                 l[i] = foo;
12                         }
13                         Console.WriteLine ("done");
14                         return 1;
15                 } catch (Exception e) {
16                         /*Create massive fragmentation - hopefully*/
17                         for (int i = 0; i < 40000; i += 2)
18                                 l[i] = null;
19                         /*Fist major schedule the given block range for evacuation*/
20                         GC.Collect ();
21                         /*Second major triggers evacuation*/
22                         GC.Collect ();
23                         Array.Clear (l, 0, 40000);
24                         l = null;
25                         Console.WriteLine ("OOM done");
26                 }
27                 return 0;
28         }
29 }
30