-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[LLVM][DWARF] Fix for memory leak #81828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is followup to llvm#8120. Missed a destuctor.
~Dwarf5AccelTableWriter() { | ||
for (DebugNamesAbbrev *Abbrev : AbbreviationsVector) | ||
Abbrev->~DebugNamesAbbrev(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just remove the allocator instead and use plain old unique pointers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'm not familiar with how the abbrev stuff is implemented, so can't speak as to how much time this allocator is saving)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to accept and land to fix the bot.
Please followup with @felipepiovezan .
BTW. std::destroy
should work here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can.... I don't really have a strong opinion on this.
It will look something like
std::unique_ptr<DebugNamesAbbrev> NewAbbrev =
std::make_unique<DebugNamesAbbrev>(std::move(Abbrev));
NewAbbrev->setNumber(AbbreviationsVector.size() + 1);
AbbreviationsVector.push_back(std::move(NewAbbrev));
AbbreviationsSet.InsertNode(AbbreviationsVector.back().get(), InsertPos);
Value->setAbbrevNumber(AbbreviationsVector.back()->getNumber());
Couple reasons for leaving it like this
- Bumpptr allocator seems to be a more standard way of dong things, although it can lead to situations like this.
- This is also how .debug_abbrev handles it. Since we are going for convergence at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy with this for now, similar to the debug_info abbrevs - be good to converge the code futher at some point, and see if there's way to do this work better, perhaps.
This is followup to #8120. Missed a
destuctor.