From 4d1abfbb93e614fcc88cbd848b4c718b702841ab Mon Sep 17 00:00:00 2001 From: David Mason Date: Wed, 14 Feb 2018 02:18:39 -0800 Subject: [PATCH] Fix for issue #13153 - change SetGCConcurrent to TemporaryDisableConcurrentGC for profiler startup path. (#16314) --- src/vm/profilinghelper.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/vm/profilinghelper.cpp b/src/vm/profilinghelper.cpp index b1fb228..d711100 100644 --- a/src/vm/profilinghelper.cpp +++ b/src/vm/profilinghelper.cpp @@ -1193,9 +1193,15 @@ HRESULT ProfilingAPIUtility::LoadProfiler( // and kill objects without relocating and thus not doing a heap walk. if (CORProfilerTrackGC()) { - LOG((LF_CORPROF, LL_INFO10, "**PROF: Turning off concurrent GC at startup.\n")); - g_pConfig->SetGCconcurrent(0); - LOG((LF_CORPROF, LL_INFO10, "**PROF: Concurrent GC has been turned off at startup.\n")); + LOG((LF_CORPROF, LL_INFO10, "**PROF: Turning off concurrent GC at startup.\n")); + // Previously we would use SetGCConcurrent(0) to indicate to the GC that it shouldn't even + // attempt to use concurrent GC. The standalone GC feature create a cycle during startup, + // where the profiler couldn't set startup flags for the GC. To overcome this, we call + // TempraryDisableConcurrentGC and never enable it again. This has a perf cost, since the + // GC will create concurrent GC data structures, but it is acceptable in the context of + // this kind of profiling. + GCHeapUtilities::GetGCHeap()->TemporaryDisableConcurrentGC(); + LOG((LF_CORPROF, LL_INFO10, "**PROF: Concurrent GC has been turned off at startup.\n")); } } -- 2.7.4