summaryrefslogtreecommitdiff
path: root/lib/VMCore/TypesContext.h
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2009-08-31 16:14:59 +0000
committerTorok Edwin <edwintorok@gmail.com>2009-08-31 16:14:59 +0000
commit2cd5155c0e8f2448dbdbc9c9cd468e589f9745e9 (patch)
tree6cc085a5fc665699d3fac6ba5f95f02f9357a42c /lib/VMCore/TypesContext.h
parent72ddf7b555a5a32c6f2330f9733bb8d036f971eb (diff)
downloadllvm-2cd5155c0e8f2448dbdbc9c9cd468e589f9745e9.tar.gz
llvm-2cd5155c0e8f2448dbdbc9c9cd468e589f9745e9.tar.bz2
llvm-2cd5155c0e8f2448dbdbc9c9cd468e589f9745e9.tar.xz
Free the constants that have no uses in ~LLVMContext.
This fixes leaks from LLVMContext in multithreaded apps. Since constants are only deleted if they have no uses, it is safe to not delete a Module on shutdown, as many single-threaded tools do. Multithreaded apps should however delete the Module before destroying the Context to ensure that there are no leaks (assuming they use a different context for each thread). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/TypesContext.h')
-rw-r--r--lib/VMCore/TypesContext.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/lib/VMCore/TypesContext.h b/lib/VMCore/TypesContext.h
index 2a287fe5df..e7950bd211 100644
--- a/lib/VMCore/TypesContext.h
+++ b/lib/VMCore/TypesContext.h
@@ -221,7 +221,6 @@ public:
// PATypeHolder won't destroy non-abstract types.
// We can't destroy them by simply iterating, because
// they may contain references to each-other.
-#if 0
for (std::multimap<unsigned, PATypeHolder>::iterator I
= TypesByHash.begin(), E = TypesByHash.end(); I != E; ++I) {
Type *Ty = const_cast<Type*>(I->second.Ty);
@@ -235,7 +234,6 @@ public:
operator delete(Ty);
}
}
-#endif
}
void RemoveFromTypesByHash(unsigned Hash, const Type *Ty) {