【发布时间】:2016-04-02 00:08:30
【问题描述】:
当我尝试这段代码时,我得到了一个 stackoverflow 异常:
Thread Tcheck= new Thread(checkbr);
Tcheck.Start();
private void checkbr()
{
try
{
var RunningProcessPaths = ProcessFileNameFinderClass.GetAllRunningProcessFilePaths();
if (RunningProcessPaths.Contains("chrome.exe"))
{
checkbr();
}
else
{
System.Threading.Thread.Sleep(500);
// TO START NEW INSTANCE OF APP
System.Diagnostics.Process.Start(Application.ExecutablePath);
Thread.Sleep(500);
Process.GetCurrentProcess().Kill();
}
}
catch (Exception)
{
checkbr();
}
}
我想知道如何清空这个应用的物理内存 因为当我在任务管理器中检查我的应用时,我发现它正在疯狂地增加使用的内存。
【问题讨论】:
-
你想做什么?
-
我只是想知道浏览器是否打开,如果它打开了,它仍然是打开还是关闭。
标签: c# multithreading stack overflow