-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Unmanaged memory growth with DiagnosticsClient #105132
Comments
Tagging subscribers to this area: @tommcdon |
Any help on this will be much appreciated. |
I split up the repro into a producer and consumer process. Then I compiled the event pipe consumer as NativeAOT to get better stack traces from native tools. There's one stack trace that stands out:
Notably, this native allocation: ...may not be freed because the code that converts I didn't try to verify the theory, there's a lot of code in-between the two places. The only thing I know for sure that the same allocation stack trace keeps popping up all the time in the allocation logs. |
@filipnavara it's meant to be freed here: But the instances appear to be cached in |
Meant to be, yes. The
There's a single instance cached in |
If my theory is correct then this should fix the leak: microsoft/perfview@main...filipnavara:perfview:memleak-fix |
Fixed. Thanks @filipnavara for PR in the perfview repo! |
Thanks @filipnavara seems to be fixed in my manual tests too |
Description
I'm running a diagnostic session on the program itself (for in-process profiling) and am facing issues noticable in ASP.NET core apps, although I think it's only showing there due to the number of events being produced.
Reproduction Steps
I've created a simple app which just connects a diagnostic session and ignores incoming events:
dotnet new webapi --use-controllers -o webapi
dotnet add package Microsoft.Diagnostics.Tracing.TraceEvent --version 3.1.13
dotnet add package Microsoft.Diagnostics.NETCore.Client --version 0.2.510501
"System.GC.HeapHardLimit": 5242880
in runtimeconfig to make sure GC runs earlyProgram.cs
, see repo: https://github.com/vaind/webapi-memdotnet build -c Release
Expected behavior
I'd expect the unmanaged memory to cap at the given
circularBufferMB: 16
+ some baseline for the runtime of course.Actual behavior
Memory grows over time:

And after a few hours:

Regression?
No response
Known Workarounds
No response
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: