2 using System.Threading;
3 using System.Reflection;
5 namespace MonoTests.Helpers {
7 public static class FinalizerHelpers {
8 private static IntPtr aptr;
10 private static unsafe void NoPinActionHelper (int depth, Action act)
13 int* values = stackalloc int [20];
14 aptr = new IntPtr (values);
19 NoPinActionHelper (depth - 1, act);
22 public static void PerformNoPinAction (Action act)
24 Thread thr = new Thread (() => NoPinActionHelper (1024, act));
30 public static class OOMHelpers {
31 public static void RunTest (string test)
33 Assembly asm = Assembly.Load (test);
36 // Support both (void) and (string[]) signatures
37 if (asm.EntryPoint.GetParameters ().Length == 1)
38 asm.EntryPoint.Invoke (null, new string[] { null });
40 asm.EntryPoint.Invoke (null, null);
41 } catch (TargetInvocationException e) {
42 if (e.InnerException is OutOfMemoryException)
43 Console.WriteLine ("Catched oom");