From ff4bcde54ccfa75b076bb49e1ac13631c7d40e84 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Wed, 29 Jun 2022 19:15:52 +0200 Subject: [PATCH] Fix ShuffleThunk cache heap There was a problem with using heap from the related LoaderAllocator for shuffle thunk cache heap. I have tested it again and it seems that the issue is gone. So I am removing the workaround, making the cache use LoaderAllocator local heap. Close #55697 --- src/coreclr/vm/loaderallocator.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/coreclr/vm/loaderallocator.cpp b/src/coreclr/vm/loaderallocator.cpp index 6cc8b62480a00..93868817b47f6 100644 --- a/src/coreclr/vm/loaderallocator.cpp +++ b/src/coreclr/vm/loaderallocator.cpp @@ -1734,11 +1734,7 @@ void AssemblyLoaderAllocator::Init(AppDomain* pAppDomain) LoaderAllocator::Init((BaseDomain *)pAppDomain); if (IsCollectible()) { - // TODO: the ShuffleThunkCache should really be using the m_pStubHeap, however the unloadability support - // doesn't track the stubs or the related delegate classes and so we get crashes when a stub is used after - // the AssemblyLoaderAllocator is gone (the stub memory is unmapped). - // https://github.com/dotnet/runtime/issues/55697 tracks this issue. - m_pShuffleThunkCache = new ShuffleThunkCache(SystemDomain::GetGlobalLoaderAllocator()->GetExecutableHeap()); + m_pShuffleThunkCache = new ShuffleThunkCache(m_pStubHeap); } }