diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2013-10-24 09:52:56 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2013-10-24 09:52:56 +0000 |
commit | 817987350442e9349dbcf3416abaadc1796036a4 (patch) | |
tree | 549dec499733819c864e8e1f88f3332741523e66 /lib/ExecutionEngine | |
parent | cdd776d13f799da1aff4b2c9c58a236bee74ea2e (diff) | |
download | external_llvm-817987350442e9349dbcf3416abaadc1796036a4.zip external_llvm-817987350442e9349dbcf3416abaadc1796036a4.tar.gz external_llvm-817987350442e9349dbcf3416abaadc1796036a4.tar.bz2 |
Revert part of r193291, restoring the deletion of loaded objects.
Without this, customers of the MCJIT were leaking memory like crazy.
It's not really clear what the *right* memory management is here, so I'm
not trying to add lots of tests or other logic, just trying to get us
back to a better baseline. I'll follow up on the original commit to
figure out the right path forward.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r-- | lib/ExecutionEngine/MCJIT/MCJIT.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/lib/ExecutionEngine/MCJIT/MCJIT.cpp index a640594..da4164e 100644 --- a/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -76,6 +76,15 @@ MCJIT::~MCJIT() { // Modules.clear(); Dyld.deregisterEHFrames(); + + LoadedObjectMap::iterator it, end = LoadedObjects.end(); + for (it = LoadedObjects.begin(); it != end; ++it) { + ObjectImage *Obj = it->second; + if (Obj) { + NotifyFreeingObject(*Obj); + delete Obj; + } + } LoadedObjects.clear(); delete TM; } |