From 6a8e8e1ca94dd75dc4ceafacf77682d716cc13b3 Mon Sep 17 00:00:00 2001 From: Gleb Balykov Date: Mon, 19 Jul 2021 19:38:41 +0300 Subject: [PATCH] Disable profile recording if arrays have failed to be allocated --- src/coreclr/vm/multicorejit.cpp | 2 ++ src/coreclr/vm/multicorejitimpl.h | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/coreclr/vm/multicorejit.cpp b/src/coreclr/vm/multicorejit.cpp index 84a6643c355a6..380a007c78085 100644 --- a/src/coreclr/vm/multicorejit.cpp +++ b/src/coreclr/vm/multicorejit.cpp @@ -1211,6 +1211,8 @@ void MulticoreJitManager::StartProfile(AppDomain * pDomain, ICLRPrivBinder *pBin if (pRecorder != NULL) { + gatherProfile = pRecorder->CanGatherProfile(); + m_pMulticoreJitRecorder = pRecorder; LONG sessionID = m_ProfileSession.Increment(); diff --git a/src/coreclr/vm/multicorejitimpl.h b/src/coreclr/vm/multicorejitimpl.h index c37ce74ad4f07..d1f05816788f2 100644 --- a/src/coreclr/vm/multicorejitimpl.h +++ b/src/coreclr/vm/multicorejitimpl.h @@ -711,6 +711,13 @@ class MulticoreJitRecorder #endif // !TARGET_UNIX } + bool CanGatherProfile() + { + LIMITED_METHOD_CONTRACT; + + return m_ModuleList != NULL && m_JitInfoArray != NULL; + } + bool IsAtFullCapacity() const { LIMITED_METHOD_CONTRACT;