Use the CLR memory profiler.  It does a good job of showing you what's
chewing up memory.  That is, if it is instances of managed classes.  If
you're leaking unmanaged memory, it's more difficult to diagnose.

-- arlie

-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Johansen
Sent: Monday, June 07, 2004 2:20 PM
To: [EMAIL PROTECTED]
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

Reply via email to