flutter / flutter/devtools

debugger causes memory leaks in the debugged program

Aperta
#9,301 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
P2 screen: debugger
Lingua principale
Dart
Stelle
1.7k
Fork
404
Merge medio
6g 17h
PR unite (30g)
18

Descrizione

```dart
import "dart:developer";
import "dart:typed_data";

@pragma("vm:never-inline")
foo(var x) {
debugger();
print(x.length);
}

main() {
for (;;) foo(new Uint8List(1 << 20));
}
```

Run the program and repeatedly press "Continue" in the debugger. Notice that the memory usage continues to grow. Without the debugger, memory quickly plateaus. (The effect is clearer with --no-concurrent-mark so the growth policy arrives at a lower level for this very high allocation rate.)

The debugger is probably retaining object ids long after the objects in question are no longer visible in the UI. Presumably this is because the debugger is sloppily using a single id zone for everything that is never discarded, instead of using a zone per refresh of the stack. (Which would predict this eventually plateaus at ~8 GB, the size of the array times the default object id ring size.)

This interfered with a user trying to debug a memory leak in https://github.com/dart-lang/sdk/issues/61036.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.