Skip to content
Merged
Changes from all 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 @@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using Microsoft.Diagnostics.DebugServices;
using Microsoft.Diagnostics.ExtensionCommands.Output;
using Microsoft.Diagnostics.Runtime;
Expand Down Expand Up @@ -138,6 +139,8 @@ private int PrintOlderGenerationRoots(GCRoot gcroot, int gen, int limit)
int count = 0;

bool noInternalRootData = true;
HashSet<ulong> uniqueRoots = new();

foreach (ClrSubHeap subheap in Runtime.Heap.SubHeaps)
{
MemoryRange internalRootArray = subheap.InternalRootArray;
Expand All @@ -159,7 +162,7 @@ private int PrintOlderGenerationRoots(GCRoot gcroot, int gen, int limit)

Console.CancellationToken.ThrowIfCancellationRequested();

if (Memory.ReadPointer(address, out ulong objAddress))
if (Memory.ReadPointer(address, out ulong objAddress) && !uniqueRoots.Contains(objAddress))
{
ClrObject obj = Runtime.Heap.GetObject(objAddress);
if (obj.IsValid)
Expand All @@ -177,6 +180,7 @@ private int PrintOlderGenerationRoots(GCRoot gcroot, int gen, int limit)
PrintPath(Console, RootCache, StaticVariables, Runtime.Heap, path);
Console.WriteLine();

uniqueRoots.Add(objAddress);
count++;
}
}
Expand Down