llvm.org GIT mirror llvm / 59d5f83
fix (part of) memory leak on shutdown. See PR2975. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68457 91177308-0d34-0410-b5e6-96231b3b80d8 Torok Edwin 10 years ago
2 changed file(s) with 20 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
4141 #include "llvm/ExecutionEngine/JIT.h"
4242 #include "llvm/ExecutionEngine/Interpreter.h"
4343 #include "llvm/ExecutionEngine/GenericValue.h"
44 #include "llvm/Support/ManagedStatic.h"
4445 #include "llvm/Support/raw_ostream.h"
4546 using namespace llvm;
4647
108109
109110 // Import result of execution:
110111 outs() << "Result: " << gv.IntVal << "\n";
112 EE->freeMachineCodeForFunction(FooF);
113 delete EE;
114 llvm_shutdown();
111115 return 0;
112116 }
665665 std::multimap TypesByHash;
666666
667667 public:
668 ~TypeMapBase()
669 {
670 for (std::multimap::iterator I
671 = TypesByHash.begin(), E = TypesByHash.end(); I != E;) {
672 Type *Ty = I->second.get();
673 if (!Ty->isAbstract() && (isa(Ty) || isa(Ty) ||
674 isa(Ty))) {
675 TypesByHash.erase(I++);
676 // PATypeHolder won't destroy it, so we must
677 Ty->destroy();
678 }
679 else
680 ++I;
681 }
682 }
683
668684 void RemoveFromTypesByHash(unsigned Hash, const Type *Ty) {
669685 std::multimap::iterator I =
670686 TypesByHash.lower_bound(Hash);