Skip to content

Sentry profiler seems to be leaking memory #5113

@kanadaj

Description

@kanadaj

Package

Sentry.Profiling

.NET Flavor

.NET

.NET Version

10.0.104

OS

Any (not platform specific)

OS Version

Any

Development Environment

Rider 2025.x (Windows)

Other Error Monitoring Solution

No

Other Error Monitoring Solution Name

No response

SDK Version

6.3.0

Self-Hosted Sentry Version

6.1.0

Workload Versions

N/A

UseSentry or SentrySdk.Init call

//...
x.AddProfilingIntegration();
//...

Steps to Reproduce

  1. Enable Sentry Profiler Integration via AddProfilerIntegration()
  2. Deploy to production for real scale workload
  3. Watch memory climb until OOM issues

Expected Result

It shouldn't :P

Actual Result

We seem to have found memory leaks in the Sentry Profiler integration added via AddProfilingIntegration() due to relying on Microsoft.Diagnostics.Tracing.Etlx. The cause seems to be from undisposed instances of TraceLog, with several gigabytes of call stacks accumulating over the period of roughly an hour for us, eventually causing process memory starvation and crashes.

Metadata

Metadata

Labels

.NETPull requests that update .net codeBugSomething isn't workingProduct: Profiling
No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions