flutter / flutter/devtools

debugger causes memory leaks in the debugged program

Abierto
#9,301 2 comentarios 1 reacción 0 asignados Ver en GitHub
P2 screen: debugger
Lenguaje dominante
Dart
Estrellas
1.7k
Forks
404
Merge medio
6 d 17 h
PR fusionados (30 d)
18

Descripción

```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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.