A
adnan.masood
I have a program which create threads in a loop, but I make sure that
it doesn't create more then 10 threads
Thread addSearchThread = new Thread
(StartSearch);
addSearchThread.Start(new object[]
{ data});
GC.Collect();
but it seems like system is hanging on to those threads...even after
they finish. When system throws this exception then I have about 1GB
left in memory, so it is not using anything close to where it should
throw that exception anyway.
If I look at System.Diagnostics.Process.GetCurrentProcess
().Threads.Count then I see that number of threads is in hundreds (my
program could create thousands of threads, but never more then 10 at a
time. It doesn't go too fast either, I wait 10 seconds before I
create anothe thread. What can I do so that system releases those
threads?
it doesn't create more then 10 threads
Thread addSearchThread = new Thread
(StartSearch);
addSearchThread.Start(new object[]
{ data});
GC.Collect();
but it seems like system is hanging on to those threads...even after
they finish. When system throws this exception then I have about 1GB
left in memory, so it is not using anything close to where it should
throw that exception anyway.
If I look at System.Diagnostics.Process.GetCurrentProcess
().Threads.Count then I see that number of threads is in hundreds (my
program could create thousands of threads, but never more then 10 at a
time. It doesn't go too fast either, I wait 10 seconds before I
create anothe thread. What can I do so that system releases those
threads?