-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: depotchest memory leak #4510
Conversation
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.
Nice :)
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.
This will crash, because of double pointer deletion, one happens from container destructor, because depot is a regular item inside locker (you have to remove depot from locker on player destructor to avoid that) and the second will trigger from shared_ptr trying to delete assigned object
@nekiro is right, if you're going to change to a shared ptr, you must change it everywhere or you will get nasty double frees |
I ran some tests, and it seems that the code below solves this issue 👇🏻 Player::~Player()
{
for (auto [_, depotChest] : depotChests) {
delete depotChest;
}
} |
superseded by #4879 |
Pull Request Prelude
Changes Proposed
items on depot cannot destroy after player logout.
after some relogins with around 100k items on depot...
BEFORE FIX:
AFTER FIX: