flutter / flutter/devtools

debugger causes memory leaks in the debugged program

未关闭
#9,301 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
P2 screen: debugger
主要语言
Dart
星标
1.7k
派生
404
平均合并
6 天 17 小时
30 天内合并 PR
18

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。