Tuesday, January 20, 2004 7:36 PM
pdbartlett
COM marshalling - aargh!
I thought the point of passing MSHLFLAGS_TABLEWEAK to CoMarshalInterface was not to affect the ref count of the object being marshalled, but in trying to diagnose an interface leak the empirical evidence seemed to suggest otherwise. There seemed to be a QI for IUnknown without a matching release. Any ideas?
UPDATE: thanks to some sterling work by my colleague, Tom, it now appears that this is a well known "issue" when no actual cross-apartment marshalling occurs (in the case I was looking at all the objects involved were in the MTA). It occurs because a stub manager is created, which holds a reference to the object, but as it is never used its reference count remains at zero, rather than increasing and then dropping to zero. This means that it is not destroyed until very late on in the piece. Apparently Don Box covers this in the excellent "Essential COM".