internal dynamic GetProcessMemoryInfo(string processName) { var memory = new PerformanceCounterCategory(".NET CLR Memory", ".").GetCounters(processName); return new { TotalMiB = memory.FirstOrDefault(i => i.CounterName == "# Bytes in all Heaps").NextValue() / 1024 / 1024, LOHSizeMiB = memory.FirstOrDefault(i => i.CounterName == "Large Object Heap size").NextValue() / 1024 / 1024, }; }