sentry-dart icon indicating copy to clipboard operation
sentry-dart copied to clipboard

Report used memory/max used memory

Open ueman opened this issue 1 year ago • 1 comments

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.

ueman avatar Jan 18 '24 09:01 ueman

From what I can see I assume currentRss and maxRss are stable enough to use

buenaflor avatar Jan 30 '24 10:01 buenaflor