2 using System.Threading;
5 This test stresses what happens when root domain threads are allocating into the nursery
6 while a domain is cleaned up.
8 This is a regression test for a crash in the domain object cleaner code that did not
9 stop-the-world before walking the heap.
13 static void AllocStuff ()
15 var x = new object ();
16 for (int i = 0; i < 300; ++i)
20 static void BackgroundNoise ()
27 for (int i = 0; i < Math.Max (1, Environment.ProcessorCount / 2); ++i) {
28 // for (int i = 0; i < 4; ++i) {
29 var t = new Thread (BackgroundNoise);
30 t.IsBackground = true;
34 for (int i = 0; i < 100; ++i) {
35 var ad = AppDomain.CreateDomain ("domain_" + i);
36 ad.DoCallBack (new CrossAppDomainDelegate (AllocStuff));
37 AppDomain.Unload (ad);
39 if (i > 0 && i % 20 == 0) Console.WriteLine ();
41 Console.WriteLine ("\ndone");