public void FindAllPaths() { using DataTarget dataTarget = TestTargets.GCRoot.LoadFullDump(); ClrRuntime runtime = dataTarget.ClrVersions.Single().CreateRuntime(); GCRoot gcroot = new GCRoot(runtime.Heap); gcroot.ClearCache(); Assert.False(gcroot.IsFullyCached); FindAllPathsImpl(gcroot); gcroot.BuildCache(CancellationToken.None); Assert.True(gcroot.IsFullyCached); FindAllPathsImpl(gcroot); }
public void GCRoots() { using (DataTarget dataTarget = TestTargets.GCRoot.LoadFullDump()) { ClrRuntime runtime = dataTarget.ClrVersions.Single().CreateRuntime(); GCRoot gcroot = new GCRoot(runtime.Heap); gcroot.ClearCache(); Assert.IsFalse(gcroot.IsFullyCached); GCRootsImpl(gcroot); gcroot.BuildCache(CancellationToken.None); gcroot.AllowParallelSearch = false; Assert.IsTrue(gcroot.IsFullyCached); GCRootsImpl(gcroot); gcroot.AllowParallelSearch = true; Assert.IsTrue(gcroot.IsFullyCached); GCRootsImpl(gcroot); } }
public void GCStaticRoots() { using DataTarget dataTarget = TestTargets.GCRoot.LoadFullDump(); ClrRuntime runtime = dataTarget.ClrVersions.Single().CreateRuntime(); ClrHeap heap = runtime.Heap; heap.StackwalkPolicy = ClrRootStackwalkPolicy.SkipStack; GCRoot gcroot = new GCRoot(runtime.Heap); gcroot.ClearCache(); Assert.False(gcroot.IsFullyCached); GCStaticRootsImpl(gcroot); gcroot.BuildCache(CancellationToken.None); gcroot.AllowParallelSearch = false; Assert.True(gcroot.IsFullyCached); GCStaticRootsImpl(gcroot); gcroot.AllowParallelSearch = true; Assert.True(gcroot.IsFullyCached); GCStaticRootsImpl(gcroot); }
/// <summary> /// Clears all caches, reclaiming most memory held by this GCRoot object. /// </summary> /// <inheritdoc /> public void ClearCache() => Root.ClearCache();