예제 #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();