[llvm] r193323 - Revert part of r193291, restoring the deletion of loaded objects.

Chandler Carruth chandlerc at gmail.com
Thu Oct 24 02:52:56 PDT 2013


Author: chandlerc
Date: Thu Oct 24 04:52:56 2013
New Revision: 193323

URL: http://llvm.org/viewvc/llvm-project?rev=193323&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp

Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=193323&r1=193322&r2=193323&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Thu Oct 24 04:52:56 2013
@@ -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;
 }





More information about the llvm-commits mailing list