[Microsoft.Build] Ignore ThreadAbortException in BuildNodeManager
[mono-project.git] / mono / tests / sgen-domain-unload.cs
blob670f218b3fb9ef73cd58ee1fbe190205d39bc4b2
1 using System;
2 using System.Collections.Generic;
4 public class Bar {
5 public object a, b, c;
8 class Driver {
9 static void ProduceSimpleHeapWithLOS () {
10 Console.WriteLine ("running in {0}", AppDomain.CurrentDomain);
11 byte[] a = new byte [4 * 1000 * 1000];
12 byte[] b = new byte [4 * 1000 * 1000];
13 byte[] c = new byte [4 * 1000 * 1000];
14 var lst = new List<object> ();
16 Bar la, lb, lc;
17 la = lb = lc = null;
18 for (int i = 0; i < 1000 * 200; ++i) {
19 var ba = new Bar ();
20 var bb = new Bar ();
21 var bc = new Bar ();
22 ba.a = la;
23 ba.b = bb;
24 ba.c = a;
26 bb.a = bc;
27 ba.b = b;
28 bb.c = lb;
30 bc.a = c;
31 bc.b = lc;
32 bc.c = ba;
34 la = ba;
35 lb = bb;
36 lc = bc;
38 lst.Add (ba);
43 static void SimpleHeapWithLOS () {
44 ProduceSimpleHeapWithLOS ();
47 static void CrossDomainTest (string name, CrossAppDomainDelegate dele) {
48 Console.WriteLine ("----Testing {0}----", name);
49 for (int i = 0; i < 20; ++i) {
50 var ad = AppDomain.CreateDomain (string.Format ("domain-{0}-{1}", name, i));
51 ad.DoCallBack (dele);
52 AppDomain.Unload (ad);
56 static void Main () {
57 CrossDomainTest ("simple-heap-with-los", Driver.SimpleHeapWithLOS);