Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to diagnose memory allocations on Mono platforms? #4862

Open
jonathanpeppers opened this issue Aug 14, 2024 · 0 comments
Open

How to diagnose memory allocations on Mono platforms? #4862

jonathanpeppers opened this issue Aug 14, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@jonathanpeppers
Copy link
Member

Background and Motivation

I'm looking at a .NET MAUI sample on Android:

It is loading a periodic table, but running many GCs:

[riodictablemaui] Explicit concurrent copying GC freed 933(127KB) AllocSpace objects, 31(4092KB) LOS objects, 49% free, 4423KB/8846KB, paused 1.328ms,169us total 33.513ms
[riodictablemaui] Explicit concurrent copying GC freed 722(46KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 4581KB/9162KB, paused 1.856ms,170us total 14.835ms
[riodictablemaui] Explicit concurrent copying GC freed 641(43KB) AllocSpace objects, 1(108KB) LOS objects, 49% free, 4525KB/9050KB, paused 1.420ms,176us total 14.112ms
[riodictablemaui] Explicit concurrent copying GC freed 619(41KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 4579KB/9158KB, paused 1.263ms,173us total 13.825ms
[riodictablemaui] Explicit concurrent copying GC freed 483(29KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 4630KB/9260KB, paused 1.379ms,171us total 14.170ms
... repeats many more times

I would like to investigate this sample on the .NET side, and understand who's allocating so much. I'm able to investigate allocations using Android Studio on the JVM side:

image

I tried using dotnet-trace --profile gc-verbose, but it doesn't look like GC-related events work on the Mono runtime.

I was looking here, maybe some GC events work, and there is a way this might work currently?

Proposed Feature

What I would like is some report:

  • Allocations (in bytes) per assembly, namespace, type, etc.
  • Ability to see the stack trace, where the object was allocated

Usage Examples

I think ideally, dotnet-trace --profile gc-verbose would work to align with this existing doc on CoreCLR:

@jonathanpeppers jonathanpeppers added the enhancement New feature or request label Aug 14, 2024
@tommcdon tommcdon added this to the 10.0.0 milestone Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants