2 dengyonggang dengyonggang 于 2015.06.29 18:51 提问

用c#写了个多线程小程序,占用内存不断的增大,虚心求教

cleanDataTimer.Elapsed += new ElapsedEventHandler(CleanData);
cleanDataTimer.Interval = 0.000000000006;
cleanDataTimer.Enabled = true;

        Thread addRCSMemoryData = new Thread(new ThreadStart(AddRCSMemoryDeviceData));
        addRCSMemoryData.Start();

        Thread addRCSDBData = new Thread(new ThreadStart(AddRCSDataBaseDeviceData));
        addRCSDBData.Start();

        Thread addRCSDBASEGEMENTDeviceDataTimer = new Thread(new ThreadStart(NetDeviceInfo.GetRCSDBASEGMENTNetDeviceData));
        addRCSDBASEGEMENTDeviceDataTimer.Start();


        Thread addRCSMemoryASEGEMENTDeviceDataTimer = new Thread(new ThreadStart(NetDeviceInfo.GetRCSMemoryASEGMENTNetDeviceData));
        addRCSMemoryASEGEMENTDeviceDataTimer.Start();

        Thread addRCSDBBSEGEMENTDeviceDataTimer = new Thread(new ThreadStart(NetDeviceInfo.GetRCSDBBSEGMENTNetDeviceData));
        addRCSDBBSEGEMENTDeviceDataTimer.Start();


        Thread addRCSMemoryBSEGEMENTDeviceDataTimer = new Thread(new ThreadStart(NetDeviceInfo.GetRCSMemoryBSEGMENTNetDeviceData));
        addRCSMemoryBSEGEMENTDeviceDataTimer.Start();









        Console.WriteLine("按回车键结束程序");
        Console.WriteLine(" 等待程序的执行......");
        Console.ReadLine();

1个回答

oyljerry
oyljerry   Ds   Rxr 2015.06.30 11:24

线程是不是不停的在分配,分配的资源使用完了,有没有让它自动回收

Csdn user default icon
上传中...
上传图片
插入图片