I have a mixed managed/unmanaged environment (Visual Studio and ReSharper) and I suspect CCW or RCW leak. Is there any way to dump all currently allocated wrappers and identify their source/target? I have WinDbg, SOS & SOSEx, so I can see total number of RCWs and CCWs with !syncblk command. I just want to see objects, so I can call !gcroot on them and otherwise examine suspects.
+1
A:
You should be able to use !dumpheap
to do this. !dumpheap -stat
would let you find the type names (if you don't already know them) and then !dumpheap -type {typename}
would give you the individual object addresses which can be passed to !gcroot
.
Curt Hagenlocher
2008-09-24 15:28:12
Ilya Ryzhenkov
2008-09-24 17:53:16
Use their type names. It's been a long time since I used these, but you should be able to use their type names to restrict the output from !dumpheap by using the -type option -- which also supports wild cards. If you're not sure what their type names are, use -stat to list all types.
Curt Hagenlocher
2008-09-24 20:25:30
@Curt, CCWs are not represented as managed object. All RCWs has type of __ComObject.
Ilya Ryzhenkov
2008-10-01 17:12:19
Ilya, not all RCW has __ComObject in the name. They may have a "normal" name, if some interop assembly is used (created by VS.Net when you reference the COM object).
Sunny
2008-10-03 19:10:49