fix (part of) memory leak on shutdown. See PR2975.
[oota-llvm.git] / examples / HowToUseJIT / HowToUseJIT.cpp
index 0482df6248fa9d5ee2928ec3f16f1205180c1e7b..b5c6d111914f36cc482efd76bd0ff7fd2addcf83 100644 (file)
@@ -42,6 +42,7 @@
 #include "llvm/ExecutionEngine/JIT.h"
 #include "llvm/ExecutionEngine/Interpreter.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
+#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
@@ -109,5 +110,8 @@ int main() {
 
   // Import result of execution:
   outs() << "Result: " << gv.IntVal << "\n";
+  EE->freeMachineCodeForFunction(FooF);
+  delete EE;
+  llvm_shutdown();
   return 0;
 }