Are you doing something like this? for(int i = 0; i<10000000; i++) { System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(PostData),state); }
Don't forget that you fill a queue. If thread pool execution rate is smaller than task submission you can have a problem. Submitting peta-trillion of tasks per second can be a problem! ----- Original Message ----- From: "Paul Johansen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 07, 2004 7:19 PM Subject: [ADVANCED-DOTNET] ThreadPool.QueueUserWorkItem Memory Problems > I have implemented a multithreaded solution where I am calling > ThreadPool.QueueUserWorkItem and I am passing both the WaitCallback > class (using a method called PostData) as well as the state object (a > custom class consisting of four strings and a bool). > > > > When I do this, I am leaking memory like crazy (> 1MB/sec). If I call > the PostData method in a single threaded fashion, I see no memory leaks > at all. Is there something that I need to do to ensure that the memory > associated with the state passed in with QueueUserWorkItem is released? > > > > It seems as though this is a similar problem to not calling EndInvoke on > asynchronous delegates, but I am not sure. > > > > Thanks for any insight. > > > > Paul > > > =================================== > This list is hosted by DevelopMentorŪ http://www.develop.com > Some .NET courses you may be interested in: > > NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles > http://www.develop.com/courses/gaspdotnetls > > View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com