Sorry, mistyped that one... A WaitCallback delegate. Yes, I am
instantiating a new one for each call. 

ThreadPool.QueueUserWorkItem(new WaitCallback(PostData), holder)


-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Sam Ang
Sent: Monday, June 07, 2004 1:49 PM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] ThreadPool.QueueUserWorkItem Memory
Problems

WaitCallback class ?

Are you creating a "WaitCallback" class for each queue
item?


--- Paul Johansen <[EMAIL PROTECTED]>
wrote:
> 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(r)
> 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





__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/

===================================
This list is hosted by DevelopMentor(r)  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