views:

39

answers:

1

Hi,

I was asked this question today by a colleague, and couldn't find any clue on the Internet... Can someone tell me if calling Marshall.ReleaseComObject()directly calls the garbage collector ? As I understand it, it only removes COM references, and then the G.C. cleans memory on its next pass, but I can be mistaken...

Thanks in advance for your help!

+3  A: 

Looking at the implementation of ReleaseComObject in Reflector shows that it doesn't. It eventually calls a native method, but I would be surprised if that could somehow force a garbage collect.

The documentation of RCW says that

The runtime performs garbage collection on the RCW.

I would interpret that as the RCW is handled by regular GC.

Brian Rasmussen
Thanks a lot Brian !
Shimrod