Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ internal unsafe void ConvertHeapDataToGraph()
}

m_converted = true;
const int MaxNodeCount = 10_000_000;

if (!m_seenStart)
{
Expand Down Expand Up @@ -712,11 +713,26 @@ internal unsafe void ConvertHeapDataToGraph()

Debug.Assert(!m_graph.IsDefined(nodeIdx));
m_graph.SetNode(nodeIdx, typeIdx, objSize, m_children);

if (m_graph.NodeCount >= MaxNodeCount)
{
doCompletionCheck = false;
m_log.WriteLine("[WARNING]: Exceeded max node count {0}. Processed {1}/{2} nodes with {3} node bulk events to go.",
MaxNodeCount, m_curNodeIdx, m_curNodeBlock.Count, m_nodeBlocks.Count);
break;
}
}

if (doCompletionCheck && m_curEdgeBlock != null && m_curEdgeBlock.Count != m_curEdgeIdx)

if (m_curEdgeBlock != null && m_curEdgeBlock.Count != m_curEdgeIdx)
{
throw new ApplicationException("Error: extra edge data. Giving up on heap dump.");
m_log.WriteLine("[WARNING]: Extra edge data found. Processing edge {0}/{1} with {2} edge bulk events to go.",
m_curEdgeIdx, m_curEdgeBlock.Count, m_edgeBlocks.Count);

if (doCompletionCheck)
{
throw new ApplicationException("Error: Giving up on heap dump.");
}
}

m_root.Build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ public static bool DumpFromEventPipe(CancellationToken ct, int processID, Memory

eventPipeDataPresent = true;

if (gcNum < 0 && data.Depth == 2 && data.Type != GCType.BackgroundGC)
if (gcNum < 0 && data.Depth == 2 && data.Type != GCType.BackgroundGC && data.Reason == GCReason.Induced)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you either update the PR description or remove this part of the change? I can't determine how this part of the change relates.

Copy link
Member Author

@hoyosjs hoyosjs Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it mostly to revert to prior behavior - although this is technically a bug and can cause an early detach from the EP session.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it mostly to revert to prior behavior

I don't know what you mean? GitHub doesn't show the change has been removed in the latest version of your PR? I've still got the same request as before - lets either remove this edit from the PR or add text to summary commit message/PR description saying what issue is being fixed here :)

{
gcNum = data.Count;
memoryGraph.Is64Bit = data.PointerSize == 8;
log.WriteLine("{0,5:n1}s: .NET Dump Started...", getElapsed().TotalSeconds);
}
};
Expand Down
10 changes: 5 additions & 5 deletions src/Tools/dotnet-gcdump/DotNetHeapDump/MemoryGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public MemoryGraph(int expectedSize, bool isVeryLargeGraph = false)
m_addressToNodeIndex = new SegmentedDictionary<Address, NodeIndex>(expectedSize);
}
else
{
m_addressToNodeIndex = new Dictionary<Address, NodeIndex>(expectedSize);
{
m_addressToNodeIndex = new Dictionary<Address, NodeIndex>(expectedSize);
}

m_nodeAddresses = new SegmentedList<Address>(SegmentSize, expectedSize);
}

Expand Down Expand Up @@ -133,13 +133,13 @@ void IFastSerializable.ToStream(Serializer serializer)
// Write out the Memory addresses of each object
if (m_isVeryLargeGraph)
{
serializer.Write(m_nodeAddresses.Count);
serializer.Write(m_nodeAddresses.Count);
}
else
{
serializer.Write((int)m_nodeAddresses.Count);
}

for (int i = 0; i < m_nodeAddresses.Count; i++)
{
serializer.Write((long)m_nodeAddresses[i]);
Expand Down