开发者

Blocking calls(wait, com calls) in STA thread

I have a windows service which creates 10+ threads which:

  • do their job and then enter WaitForMultipleObjects state until they are resumed again ..
  • each thread creates TDCOMConnection component calls method on its AppServer and then closes the connection

The service works fine, however I have seen memory leaks problems.

I am just curious if that issue can be related with message pumping.

I have always thought that message pumping in STA threads should only be applied when I use com marshalling (in situation that i have a proxy between two threads)

But today I read somewhere that in case blocking calls I should take care of messages. Is that true?

However My application still function correctly, doesn't blo开发者_如何学编程ck itself ...

Maybe I should use: CoWaitForMultipleHandles instead of: WaitForMultipleObjects?

Any thoughts on this issue?


I don't believe that using WaitForMultipleObjects rather than CoWaitForMultipleHandles will result in memory leaks. Which function you use is really up to you but should have no impact on whether or not you leak.

To solve this I think you need to get some detailed diagnostics about your leaks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜