@$(RUNTIME) bug-438454.exe > bug-438454.exe.stdout
@diff bug-438454.exe.stdout $(srcdir)/bug-438454.exe.stdout.expected
+OOM_TESTS = \
+ gc-oom-handling.exe \
+ gc-oom-handling2.exe
+
+
+test-oom: $(OOM_TESTS)
+ @for fn in $+ ; do \
+ echo "Testing $$fn ..."; \
+ MONO_GC_PARAMS=max-heap-size=16m,major=marksweep-par MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout || exit 1; \
+ MONO_GC_PARAMS=max-heap-size=16m MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout || exit 1; \
+ MONO_GC_PARAMS=max-heap-size=16m $(RUNTIME) $$fn > $$fn.stdout || exit 1; \
+ done
+
+
noinst_LTLIBRARIES = libtest.la
INCLUDES = $(GLIB_CFLAGS) $(GMODULE_CFLAGS)
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+class Driver {
+ static int Main () {
+ Console.WriteLine ("start");
+ var l = new List<object> ();
+ try {
+ for (int i = 0; i < 40000; ++i) {
+ var foo = new byte[2000];
+ //Console.WriteLine ("done {0}",i);
+ if (foo == null)
+ Console.WriteLine ("WTF");
+ l.Add (foo);
+ }
+ Console.WriteLine ("done");
+ return -1;
+ } catch (Exception e) {
+ l.Clear ();
+ l = null;
+ Console.WriteLine ("OOM done");
+ }
+ return 0;
+ }
+}
+
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+class Driver {
+ static int Main () {
+ Console.WriteLine ("start");
+ var r = new Random (123456);
+ var l = new List<object> ();
+ try {
+ for (int i = 0; i < 40000; ++i) {
+ var foo = new byte[r.Next () % 4000];
+ l.Add (foo);
+ }
+ Console.WriteLine ("done");
+ return -1;
+ } catch (Exception e) {
+ l.Clear ();
+ l = null;
+ Console.WriteLine ("OOM done");
+ }
+ return 0;
+ }
+}
+