By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,892 Members | 1,274 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,892 IT Pros & Developers. It's quick & easy.

MSMQ Destruction

P: n/a
Hello

I have created MessageQueue called Req_MSMQ and have a PeekCompleted event added as follow
Req_MSMQ.PeekCompleted += new PeekCompletedEventHandler(OnRequestPeeked)
Req_MSMQ.BeginPeek()

When I destroy this object (Req_MSMQ) as follow, It doesn't clean up Memory properly.
Req_MSMQ.PeekCompleted -= new PeekCompletedEventHandler(OnRequestPeeked)
Req_MSMQ.Dispose()

But If i don't create the PeekCompleted event, everything looks fine

I used System.GC.GetTotalMemory(true) to get the free mem.. I know GC staff!!!... It eventually goes out of resources on long run. That is bad

Thanks in advanc

Bob An
bo*@milanosystems.com
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I had a similar problem
although I wasn't using an event callback, just a timeout on the peek

Usually, its a good idea to set the object to null as well as call Dispose. Same thing happens in java

try setting the object to null so as to indicate to the GC that there are no references and that its safe to actually clean out the object

Calling System.GC.Collect is merely a suggestion to the GC to run, it doesn't force GC -- at least that's what I've read in other groups and sites

FWI
Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.