Home

memory leak when dumping exceptions

edited August 2021

Repeatedly dumping exceptions via a DumpContainer leads to increasing memory use. Triggering a GC via the menu entry has no effect. The following script with 1M iterations consumes about 3GB eventually, and I had a similar script consume >30GB.

void Main()
{
    var state = new State { Ex = new Exception() };
    var dump = new DumpContainer(state).Dump();
    for (var i = 0; i < 1000_000; i++)
    {
        state.Counter = i;
        dump.Refresh();
    }
}

class State
{
    public int Counter;
    public Exception Ex;
}

Comments

Sign In or Register to comment.