Backgroundworker memory leak and the "using" statement
We have a program (Form) which uses many backgroundworks in many occasions
(we cannot reuse them). We notices that the memory of the program keeps
growing and analyzing this with a memory profiler I've noticed that there
are many backgourndworker objects.
I thought that if I use the "using" statement will do the trick and
dispose the objects but it doesn't seem to work. using (BackgroundWorker
bgwConnectClient = new BackgroundWorker()) { bgwConnectClient.DoWork +=
new DoWorkEventHandler(bgwConnectClient_DoWork);
bgwConnectClient.RunWorkerAsync(); }
Any idea??
No comments:
Post a Comment