Skip to content

Memory issue/leak with Tracing enabled #3431

@jamescrosswell

Description

@jamescrosswell

Running the following program with tracing enabled results in increasing memory usage which does not appear to be cleaned up by GC.

Sample program

SentrySdk.Init(o =>
{
    o.Dsn = "https://[email protected]:65535/2147483647";
    o.Release = "release";
    o.TracesSampleRate = 1.0;
});

while(true)
{
    DoWork();
}

void DoWork()
{
    var transaction = SentrySdk.StartTransaction("name", "operation");

    for (var i = 0; i < 10; i++)
    {
        var span = transaction.StartChild("operation");
        Console.WriteLine($"{i}: {Fibonacci(i)}");
        span.Finish();
    }

    transaction.Finish();

    int Fibonacci(int n) => n switch
    {
        0 => 0,
        1 => 1,
        _ => Fibonacci(n - 1) + Fibonacci(n - 2)
    };
}

Memory profile

Targeting net6.0...

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions