Click here to Skip to main content
Sign Up to vote bad
good
See more: C#
I have been using the C# smart thread pool to do some work but found the current smart thread pool release DOES NOT anything about the removed "idle threads". This may or may not cause smart thread pool memory leaks.
 
In the smartthreadpool.ProcessQueueItem() method there are several times the method calls InforComleted() method when a idle thread(s) is timed out. But the InformCompleted() just removes the thread from the dictionary and didn't the delete these threads:
private void InformCompleted()
{
   if(_workerThreads.Contains(Thread.CurrentThread))
   {
      _workerThreads.Remove(Thread.CurrentThread);
   }
}
I'm wondering if there is anyone out there already solved this problem and test it out.
 
Thank you very much.
 
Best regards,
CodeBeetle123
Posted 7 hrs ago
Edited 7 hrs ago
RaisKazi29.5K

Comments
Why? This is not how Thread Pool is used. —SA

1 solution

Normally, you DON'T remove threads from the pool. They sit there idle, waiting for work to do so you don't incur the rather large overhead of spinning a new thread up!
 
If you've got questions about a particular library, you contact the author of that library. Just because you saw it in an article here does NOT mean that everyone around here knows exactly what you're talking about and has used every bit of code in every article.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 585
1 Maciej Los 395
2 OriginalGriff 345
3 Dave Kreskowiak 325
4 Mohammed Hameed 303
0 Sergey Alexandrovich Kryukov 5,619
1 OriginalGriff 4,532
2 CPallini 2,667
3 Róhãn Lëuvä 2,337
4 Tadit Dash 1,443


Advertise | Privacy | Mobile
Web01 | 2.6.130513.1 | Last Updated 13 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid