Does Marshal.ReleaseComObject call the garbage collector?
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 开发者_StackOverflow中文版the G.C. cleans memory on its next pass, but I can be mistaken...
Thanks in advance for your help!
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.
精彩评论