Consider detaching game from DevToolsService when not needed

Aperta
#3,316 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@filiph ci sta già lavorando.

Dal 21/9/2024.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

enhancement
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?
Lingua principale
Dart
Stelle
10.8k
Fork
1.1k
Merge medio
1g 21h
PR unite (30g)
50

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di flame-engine/flame

Tutte le issue di flame-engine/flame

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.