C# 内存信息

时间:2025-01-14 09:36:38

 

Process proc = Process.GetCurrentProcess();
                Console.Write("专用工作集内存:");
                Console.WriteLine(proc.PrivateMemorySize64 / 1024);
                Console.Write("工作集内存:");
                Console.WriteLine(proc.WorkingSet64 / 1024.0);
                Console.Write("最大内存:");
                Console.WriteLine(proc.PeakWorkingSet64 / 1024.0);
                Console.Write("线程数:");
                Console.WriteLine(proc.Threads.Count);