flutter / flutter/devtools

debugger causes memory leaks in the debugged program

Đang mở
#9,301 2 bình luận 1 reaction 0 người được giao Xem trên GitHub
P2 screen: debugger
Ngôn ngữ chính
Dart
Star
1.7k
Fork
404
Merge trung bình
6 ngày 17 giờ
Pull request đã merge (30 ngày)
18

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.