我写了一个winform程序,用多线程从GSD获取数据放到本地数据库或内存,当窗体关闭时,我把线程都关闭
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
for (int i = 0; i < threadList.Count; i++)
{
threadList[i].Abort();
}
}
但是,这样只是清除了程序所占用的CPU而程序占用的内存并没有释放,任务管理器中这个进程还一直存在,怎么结束这个进程,并释放它所占用的内存啊?
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
for (int i = 0; i < threadList.Count; i++)
{
threadList[i].Abort();
}
}
但是,这样只是清除了程序所占用的CPU而程序占用的内存并没有释放,任务管理器中这个进程还一直存在,怎么结束这个进程,并释放它所占用的内存啊?
或者每个thread.IsBackground = true;
{
Application.ExitThread();
Application.Exit();
}