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

Fix memory leak in waterworld_v4 by clearing old handlers before adding new ones #1218

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

florin-pop
Copy link
Contributor

Description

We recently tested waterworld_v4 with rllib and noticed that it was slowly leaking memory. Over 1M episodes it would slowly fill the 128GB of memory allocated to the test environment. One culprit seems to be the handlers list which is not cleared when resetting the environment so each time add_handlers() is called, new collision handlers are created and appended to this list.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots

Before fix

Screenshot from 2024-06-24 05-08-14

After fix

Screenshot from 2024-06-24 05-07-37

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have run pytest -v and no errors are present.
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I solved any possible warnings that pytest -v has generated that are related to my code to the best of my knowledge.
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Member

@jjshoots jjshoots left a comment

Choose a reason for hiding this comment

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

Great catch! Thanks for finding this!

@jjshoots jjshoots merged commit ace3894 into Farama-Foundation:master Jul 2, 2024
43 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants