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

Consider detaching game from DevToolsService when not needed #3316

Open
1 task done
filiph opened this issue Sep 21, 2024 · 1 comment
Open
1 task done

Consider detaching game from DevToolsService when not needed #3316

filiph opened this issue Sep 21, 2024 · 1 comment
Assignees

Comments

@filiph
Copy link
Contributor

filiph commented Sep 21, 2024

What could be improved

Not a big deal, but currently, when running a game in debug mode, any FlameGame that is ever started will forever be retained in memory unless replaced with a different FlameGame.

From FlameGame's constructor:

    if (kDebugMode) {
      DevToolsService.initWithGame(this);
    }

There is no DevToolsService.detachGame() or anything similar.

Screenshot 2024-09-21 at 14 25 08

Why should this be improved

This can be confusing when one's looking at memory (albeit I agree that one should be normally doing that in profile mode) and sees a game that's supposed to be gone a long time ago, and won't go away even after manual GC.

This almost sent me on a wild goose chase for a giant game-sized memory leak.

Risks

  • Some people might want to inspect their game after it's been disposed?
  • Could introduce a DevTools connector bug where game's disposed too soon, for example.

More information

I'm not sure myself if this is something worth addressing. Just putting this here before I forget.

Other

  • Are you interested in working on a PR for this?
@spydon
Copy link
Member

spydon commented Sep 21, 2024

Sounds like a good idea, shouldn't be too hard to fix up!
I'll assign you to the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants