From bdcc69afe6af7ef2792ebfce31cc320705f59e20 Mon Sep 17 00:00:00 2001 From: David Mason Date: Thu, 11 Oct 2018 08:22:02 -0700 Subject: [PATCH] fix issue where we wouldn't throw OOM after failing to allocate more space for finalize queue (dotnet/coreclr#20363) Commit migrated from https://github.com/dotnet/coreclr/commit/fe45ba34cd88e9890efbd03f0252cb536fc56a89 --- src/coreclr/src/vm/comutilnative.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/coreclr/src/vm/comutilnative.cpp b/src/coreclr/src/vm/comutilnative.cpp index d564f9a..15bde67 100644 --- a/src/coreclr/src/vm/comutilnative.cpp +++ b/src/coreclr/src/vm/comutilnative.cpp @@ -1279,7 +1279,10 @@ FCIMPL1(void, GCInterface::ReRegisterForFinalize, Object *obj) if (obj->GetMethodTable()->HasFinalizer()) { HELPER_METHOD_FRAME_BEGIN_1(obj); - GCHeapUtilities::GetGCHeap()->RegisterForFinalization(-1, obj); + if (!GCHeapUtilities::GetGCHeap()->RegisterForFinalization(-1, obj)) + { + ThrowOutOfMemory(); + } HELPER_METHOD_FRAME_END(); } } -- 2.7.4