This is an archive of the discontinued LLVM Phabricator instance.

memory leak in LegacyPassManager.cpp
Needs ReviewPublic

Authored by huiwu on Dec 20 2015, 6:31 PM.

Details

Reviewers
mehdi_amini
Summary

in function MPPassManager::addLowerLevelRequiredPass in file LegacyPassManager.cpp, there is a memory leak found.

Diff Detail

Repository
rL LLVM

Event Timeline

huiwu updated this revision to Diff 43345.Dec 20 2015, 6:31 PM
huiwu retitled this revision from to memory leak in LegacyPassManager.cpp.
huiwu updated this object.
huiwu added a reviewer: Restricted Project.
huiwu set the repository for this revision to rL LLVM.
huiwu added a project: Restricted Project.

You should add llvm-commits as subscriber.

huiwu edited subscribers, added: llvm-commits; removed: mehdi_amini.Dec 20 2015, 9:07 PM

Is there a way to reproduce? Should we pass a unique_ptr in?

mehdi_amini edited reviewers, added: mehdi_amini; removed: Restricted Project.Jan 4 2016, 6:01 PM
mehdi_amini removed a project: Restricted Project.
huiwu added a comment.Jan 5 2016, 9:19 PM

If we add a pass twice into a ModulePass (for example, if a ModulePass depends on two FunctionPasses, and the second FunctionPass also depends on the first one), this leak can happen.

I think using unique_ptr can work, but need touch the key data structure of the pass management, and will be a much more complex fix.