forked from OSchip/llvm-project
4affd0c40e
NestedPattern uses a BumpPtrAllocator to store child (nested) pattern objects to decrease the overhead of dynamic allocation. This assumes all allocations happen inside the allocator that will be freed as a whole. However, NestedPattern contains `std::function` as a member, which allocates internally using `new`, unaware of the BumpPtrAllocator. Since NestedPattern only holds pointers to the nested patterns allocated in the BumpPtrAllocator, it never calls their destructors, so the destructor of the `std::function`s they contain are never called either, leaking the allocated memory. Make NestedPattern explicitly call destructors of nested patterns. This additionally requires to actually copy the nested patterns in copy-construction and copy-assignment instead of just sharing the pointer to the arena-allocated list of children to avoid double-free. An alternative solution would be to add reference counting to the list of arena-allocated list of children. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D98485 |
||
---|---|---|
.. | ||
AliasAnalysis | ||
Presburger | ||
AffineAnalysis.cpp | ||
AffineStructures.cpp | ||
AliasAnalysis.cpp | ||
BufferAliasAnalysis.cpp | ||
CMakeLists.txt | ||
CallGraph.cpp | ||
LinearTransform.cpp | ||
Liveness.cpp | ||
LoopAnalysis.cpp | ||
NestedMatcher.cpp | ||
NumberOfExecutions.cpp | ||
PresburgerSet.cpp | ||
SliceAnalysis.cpp | ||
Utils.cpp |