[Mlir-commits] [mlir] 3b04af4 - Fix some memory leak in MLIRContext with respect to registered types/attributes interfaces
Mehdi Amini
llvmlistbot at llvm.org
Sat Jul 11 13:05:59 PDT 2020
Author: Mehdi Amini
Date: 2020-07-11T20:05:29Z
New Revision: 3b04af4d84fbffa6a2e90cfd187ed01092b45684
URL: https://github.com/llvm/llvm-project/commit/3b04af4d84fbffa6a2e90cfd187ed01092b45684
DIFF: https://github.com/llvm/llvm-project/commit/3b04af4d84fbffa6a2e90cfd187ed01092b45684.diff
LOG: Fix some memory leak in MLIRContext with respect to registered types/attributes interfaces
Differential Revision: https://reviews.llvm.org/D83618
Added:
Modified:
mlir/lib/IR/MLIRContext.cpp
Removed:
################################################################################
diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp
index 4c31ef318fd9..a4e833cbf77c 100644
--- a/mlir/lib/IR/MLIRContext.cpp
+++ b/mlir/lib/IR/MLIRContext.cpp
@@ -331,6 +331,12 @@ class MLIRContextImpl {
public:
MLIRContextImpl() : identifiers(identifierAllocator) {}
+ ~MLIRContextImpl() {
+ for (auto typeMapping : registeredTypes)
+ typeMapping.second->~AbstractType();
+ for (auto attrMapping : registeredAttributes)
+ attrMapping.second->~AbstractAttribute();
+ }
};
} // end namespace mlir
More information about the Mlir-commits
mailing list