summaryrefslogtreecommitdiff
path: root/src/vm/method.cpp
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2019-01-09 22:21:03 +0100
committerGitHub <noreply@github.com>2019-01-09 22:21:03 +0100
commit660eb0018871a88049ed66a17817dcf72278c9d4 (patch)
treee623d1727b8d3450a638c0dc43135202db34f8b3 /src/vm/method.cpp
parent5478a2f17f58033c32a810526b4868cba7952f32 (diff)
downloadcoreclr-660eb0018871a88049ed66a17817dcf72278c9d4.tar.gz
coreclr-660eb0018871a88049ed66a17817dcf72278c9d4.tar.bz2
coreclr-660eb0018871a88049ed66a17817dcf72278c9d4.zip
Fix DynamicMethodDesc memory leak (#21891)
The DynamicMethodTable::AddMethodsToList was incorrectly allocating the MethodDescChunk from the domain's LoaderAllocator instead of the context specific one. Thus the allocated memory was leaking after a collectible AssemblyLoadContext was collected. There was also a problem with the DynamicMethodDesc::Destroy being called twice for collectible classes - once by RuntimeMethodHandle::Destroy() and once when the DomainFile destructor was called. Due to the primary issue, this problem was not visible, since the domain's LoaderAllocator is never unmapped. But it started to cause AV after the primary issue was fixed.
Diffstat (limited to 'src/vm/method.cpp')
-rw-r--r--src/vm/method.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/vm/method.cpp b/src/vm/method.cpp
index 9c19c688ac..09bc2cbf9f 100644
--- a/src/vm/method.cpp
+++ b/src/vm/method.cpp
@@ -226,14 +226,7 @@ BaseDomain *MethodDesc::GetDomain()
//*******************************************************************************
LoaderAllocator * MethodDesc::GetLoaderAllocatorForCode()
{
- if (IsLCGMethod())
- {
- return ::GetAppDomain()->GetLoaderAllocator();
- }
- else
- {
- return GetLoaderAllocator();
- }
+ return GetLoaderAllocator();
}