示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
        }
示例#4
0
 /// <summary>
 ///     Clears all caches, reclaiming most memory held by this GCRoot object.
 /// </summary>
 /// <inheritdoc />
 public void ClearCache() => Root.ClearCache();