+ // Several tests in this file, to run properly, allocate 4GB objects.
+ // Obviously this creates problems on several kinds of systems, so we
+ // conservatively skip these tests unless we find a high-RAM environment.
+ // Checking RAM requires PerformanceCounter which is absent on mobile,
+ // so any test that calls this must be category MobileNotWorking.
+ static void RequireHighMemoryTestEnvironment ()
+ {
+#if MOBILE
+ Assert.Ignore("PerformanceCounter not available.");
+#else
+ if (!Environment.Is64BitProcess)
+ Assert.Ignore("This test cannot run on a 32-bit system.");
+
+ // Require 6 GB available RAM, for the 4GB string plus 2GB headroom
+ var pc = new PerformanceCounter ("Mono Memory", "Available Physical Memory");
+
+ if (pc.RawValue < 6L*1024L*1024L*1024L)
+ Assert.Ignore("This machine may not have enough RAM to run this test.");
+#endif
+ }
+