Skip to content

Gc dump collection can run out of memory with certain type of allocations #1126

Open
@wiktork

Description

@wiktork

Create an app that allocates a tree like structure with a Node that contains a List<Node> types. After about a million nodes (about 150Mi gc heap size), gcdump calls crash dotnet-monitor. Note there are no cycles.

System.InvalidOperationException: Error:
---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Collections.Generic.Dictionary2.Resize(Int32 newSize, Boolean forceNewHashCodes) at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at Graphs.MemoryGraph.GetNodeIndex(UInt64 objectAddress) in C:\dd\Github\wiktork\diagnostics\src\Tools\dotnet-gcdump\DotNetHeapDump\MemoryGraph.cs:line 97
at DotNetHeapDumpGraphReader.ConvertHeapDataToGraph() in C:\dd\Github\wiktork\diagnostics\src\Tools\dotnet-gcdump\DotNetHeapDump\DotNetHeapDumpGraphReader.cs:line 680
at Microsoft.Diagnostics.Monitoring.EventPipe.EventGCDumpPipeline.OnEventSourceAvailable(EventPipeEventSource eventSource, Func`1 stopSessionAsync, CancellationToken token) in C:\dd\Github\wiktork\diagnostics\src\Microsoft.Diagnostics.Monitoring.EventPipe\GCDump\EventGCDumpPipeline.cs:line 121

The container limit for dotnet-monitor above was 512Mi. With currently recommended limits (256Mi), dotnet-monitor is Killed by the kernel.

This looks similar to dotnet/diagnostics#2404

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions