Skip to content
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

Landstalker: remove global ref to multiworld #4175

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

Zannick
Copy link
Contributor

@Zannick Zannick commented Nov 11, 2024

What is this fixing or adding?

LandstalkerWorld's cached_spheres holds a reference to the multiworld, which leaks the multiworld if multidata is skipped. Instead of making it a class variable, give a reference to each matching world. These count as circular references, so the multiworld is correctly GC'ed even if multidata is skipped.

How was this tested?

Run on console: python Generate.py --seed=42 --skip_output

Before:

AssertionError: MultiWorld object was not de-allocated, it's referenced 62 times. This would be a memory leak.
Press enter to close.

After: (no error)

`cached_spheres` holds a reference to the multiworld, which leaks the multiworld if multidata is skipped. Instead of making it a class variable, give a reference to each matching world.
@github-actions github-actions bot added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Nov 11, 2024
@Zannick
Copy link
Contributor Author

Zannick commented Nov 11, 2024

@Dinopony as world maintainer

@Dinopony
Copy link
Collaborator

Looks good to me, is there anything I must do for it to be merged?

@Exempt-Medic Exempt-Medic added is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world. labels Nov 12, 2024
@Exempt-Medic Exempt-Medic removed the waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world. label Nov 12, 2024
Copy link
Collaborator

@Exempt-Medic Exempt-Medic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM. It generates just fine still and spoilers before/after are identical

@Exempt-Medic Exempt-Medic added waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Nov 12, 2024
@Exempt-Medic
Copy link
Collaborator

Looks good to me, is there anything I must do for it to be merged?

@Dinopony Generally, you can just leave an approving review and say what you tested. Should be able to go to "Files changed" and then "Review Changes"

@Dinopony
Copy link
Collaborator

Managed to test generating a few random seeds, it appears to be working. Thanks for making that change 👍

@NewSoupVi
Copy link
Member

If it cleans up correctly now anyway, is the modify multidata actually still necessary?

@Zannick
Copy link
Contributor Author

Zannick commented Nov 12, 2024

I don't know but I suppose so.

@NewSoupVi NewSoupVi merged commit c295926 into ArchipelagoMW:main Nov 13, 2024
18 checks passed
@Zannick Zannick deleted the leak branch November 13, 2024 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants