[gc] Move OOM handling into the runtime from the GC.
[mono.git] / mono / sgen / sgen-alloc.c
index ca9d645e6aa78922de22b7aa2fa896e3eb7fbfa3..349eff5401457757c9757591a398a275d7990aab 100644 (file)
@@ -426,8 +426,6 @@ sgen_alloc_obj (GCVTable vtable, size_t size)
        if (!SGEN_CAN_ALIGN_UP (size))
                return NULL;
 
-#ifndef DISABLE_CRITICAL_REGION
-
        if (G_UNLIKELY (has_per_allocation_action)) {
                static int alloc_count;
                int current_alloc = InterlockedIncrement (&alloc_count);
@@ -452,12 +450,10 @@ sgen_alloc_obj (GCVTable vtable, size_t size)
                return res;
        }
        EXIT_CRITICAL_REGION;
-#endif
+
        LOCK_GC;
        res = sgen_alloc_obj_nolock (vtable, size);
        UNLOCK_GC;
-       if (G_UNLIKELY (!res))
-               sgen_client_out_of_memory (size);
        return res;
 }