]> granicus.if.org Git - llvm/commitdiff
Revert part of r193291, restoring the deletion of loaded objects.
authorChandler Carruth <chandlerc@gmail.com>
Thu, 24 Oct 2013 09:52:56 +0000 (09:52 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 24 Oct 2013 09:52:56 +0000 (09:52 +0000)
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

lib/ExecutionEngine/MCJIT/MCJIT.cpp

index a6405947abaf96ec4c70dc0a7e3ddbccc5b5c89f..da4164e6476a518c058f92b345d518c68713e979 100644 (file)
@@ -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;
 }