0
I’m having a problem in my program its function is to display on the screen how much ram memory the process is currently consuming and display the peak of memory usage, so my problem is when I close the process, the program stops displaying the ram peak.
Here the part of the code that displays the ram peak:
public string vmax()
{
System.Diagnostics.Process[] ieProcs = Process.GetProcessesByName(label92.Text);
double avvv = 0;
string abi = null;
try
{
if (ieProcs.Length > 0)
{
foreach (System.Diagnostics.Process p in ieProcs)
{
String physicalMem = p.PeakWorkingSet64.ToString();
abi = physicalMem;
}
}
avvv = double.Parse(abi);
avvv = avvv * 0.001 / 1024;
return avvv + " K";
}
catch
{
return "";
}
}
private void timer1_Tick(object sender, EventArgs e)
{
label90.Text = vmax();
}
With the calculator process open:
With the calculator process closed:
I wanted even when I closed the process it would continue displaying the last value recorded by the peak.