sentry-dart
sentry-dart copied to clipboard
Report used memory/max used memory
Problem Statement
In order to better understand the memory usage, Sentry should report the used memory of an application.
Solution Brainstorm
Dart offers to query some memory information:
- https://api.dart.dev/stable/3.2.5/dart-io/ProcessInfo/currentRss.html
- https://api.dart.dev/stable/3.2.5/dart-io/ProcessInfo/maxRss.html
- https://api.dart.dev/stable/3.2.5/dart-developer/NativeRuntime/writeHeapSnapshotToFile.html (most likely not available in release mode tho)
- There's also https://github.com/dart-lang/leak_tracker/tree/main/pkgs/memory_usage doing some more
These APIs make it available for Dart and Flutter.
Are you willing to submit a PR?
Yes
One problem with this is, that this is a pretty new API, meaning using it would break for currently supported lower versions.
From what I can see I assume currentRss and maxRss are stable enough to use