Пример #1
0
        private void Refresh()
        {
            TrackedMemoryObjects.Where(x => !x.IsAlive()).ToList().ForEach(x => x.RemainingLifetimeAfterGC--);
            TrackedMemoryObjects.RemoveAll(x => !x.IsAlive() && x.RemainingLifetimeAfterGC < 0);
            InstancedTrackedMemoryObjects.ReplaceAll(TrackedMemoryObjects);
            LastRefreshText = "Last refreshed: " + DateTime.Now;

            var sizeUsed = System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64;

            CurrentMemoryUsageText = "Current memory usage: " + FileSize.FormatSize(sizeUsed);

            TotalLargeInUseStr   = FileSize.FormatSize(MemoryManager.LargePoolTotalSize);
            LargeInUseStr        = FileSize.FormatSize(MemoryManager.LargePoolInUseSize);
            LargeFreeStr         = FileSize.FormatSize(MemoryManager.LargePoolFreeSize);
            TotalSmallInUseStr   = FileSize.FormatSize(MemoryManager.SmallPoolTotalSize);
            SmallInUseStr        = FileSize.FormatSize(MemoryManager.SmallPoolInUseSize);
            SmallFreeStr         = FileSize.FormatSize(MemoryManager.SmallPoolFreeSize);
            MaxBufferSize        = FileSize.FormatSize(MemoryManager.MaximumBufferSize);
            MemoryBlockSize      = FileSize.FormatSize(MemoryManager.BlockSize);
            SmallBlocksAvailable = MemoryManager.SmallBlocksAvailable;
            LargeBlocksAvailable = MemoryManager.LargeBlocksAvailable;

            MaxMemoryObserved     = Math.Max(MaxMemoryObserved, sizeUsed);
            MaxMemoryObservedText = $"Max memory used: {FileSize.FormatSize(MaxMemoryObserved)}";
            //foreach (var item in InstancedTrackedMemoryObjects)
            //{
            //    item.RefreshStatus();
            //}
        }
Пример #2
0
 private void Refresh()
 {
     TrackedMemoryObjects.Where(x => !x.IsAlive()).ToList().ForEach(x => x.RemainingLifetimeAfterGC--);
     TrackedMemoryObjects.RemoveAll(x => !x.IsAlive() && x.RemainingLifetimeAfterGC < 0);
     InstancedTrackedMemoryObjects.ReplaceAll(TrackedMemoryObjects);
     LastRefreshText        = "Last refreshed: " + DateTime.Now;
     CurrentMemoryUsageText = "Current process allocation: " + ByteSize.FromBytes(System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64);
     //foreach (var item in InstancedTrackedMemoryObjects)
     //{
     //    item.RefreshStatus();
     //}
 }
        private void Refresh()
        {
            TrackedMemoryObjects.Where(x => !x.IsAlive()).ToList().ForEach(x => x.RemainingLifetimeAfterGC--);
            TrackedMemoryObjects.RemoveAll(x => !x.IsAlive() && x.RemainingLifetimeAfterGC < 0);
            InstancedTrackedMemoryObjects.ReplaceAll(TrackedMemoryObjects);
            LastRefreshText        = "Last refreshed: " + DateTime.Now;
            CurrentMemoryUsageText = "Current process allocation: " + FileSize.FormatSize(System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64);

            LargeInUseStr   = FileSize.FormatSize(MixinHandler.MixinMemoryStreamManager.LargePoolInUseSize);
            LargeFreeStr    = FileSize.FormatSize(MixinHandler.MixinMemoryStreamManager.LargePoolFreeSize);
            SmallInUseStr   = FileSize.FormatSize(MixinHandler.MixinMemoryStreamManager.SmallPoolInUseSize);
            SmallFreeStr    = FileSize.FormatSize(MixinHandler.MixinMemoryStreamManager.SmallPoolFreeSize);
            MaxBufferSize   = FileSize.FormatSize(MixinHandler.MixinMemoryStreamManager.MaximumBufferSize);
            MemoryBlockSize = FileSize.FormatSize(MixinHandler.MixinMemoryStreamManager.BlockSize);
            //foreach (var item in InstancedTrackedMemoryObjects)
            //{
            //    item.RefreshStatus();
            //}
        }
 private void CleanUpOldRefs_Click(object sender, RoutedEventArgs e)
 {
     TrackedMemoryObjects.RemoveAll(x => !x.IsAlive());
     InstancedTrackedMemoryObjects.ReplaceAll(TrackedMemoryObjects);
 }