I believe so... But to be certain of what's happening, you might create a little ATL COM object that does nothing but log it's addrefs and releases.
Charlie Poole [EMAIL PROTECTED] > -----Original Message----- > From: Moderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] Behalf Of TIAGO PASCOAL > (Interaction) > Sent: Wednesday, July 09, 2003 2:52 AM > To: [EMAIL PROTECTED] > Subject: Re: [ADVANCED-DOTNET] ReleaseCOMObject from Managed code > > > Does this include COM references obtained via code like this? : > > type comType = Type.GetTypeFromProgID("clsid"); > > object comObj = Activator.CreateInstance(comType); > > ???? Is it valid (should we?) invoke > > while(Marshal.ReleaseComObject(comObj) > 0); > > Thanks. > > -- > Regard your good name as the richest jewel you can possibly be > possessed of > - for credit is like fire; > when once you have kindled it you may easily preserve it, but if you once > extinguish it, you will find > it an arduous task to rekindle it again. The way to gain a good reputation > is to endeavor to be what you desire to appear." > [Socrates] > > > -----Original Message----- > > From: Charlie Poole [mailto:[EMAIL PROTECTED] > > Sent: quarta-feira, 9 de Julho de 2003 0:44 > > To: [EMAIL PROTECTED] > > Subject: Re: [ADVANCED-DOTNET] ReleaseCOMObject from Managed code > > > > > > Each time a COM reference is returned from unmanaged code, > > the reference count in the runtime callable wrapper is > > incremented. You could release /all/ refrences from managed > > code by calling ReleaseComObject in a loop until the returned > > count was zero. > > > > The situations in which it's reasonable and safe to do this > > are pretty limited, however. The purpose of the reference > > count is to /avoid/ the COM object being released until all > > it's clients have indicated they no longer need it. Ideally, > > each object that acquires a reference should release the count once. > > > > I would only release all the references in the way described > > in a situation like a cleanup method prior to shutdown. > > > > Charlie Poole > > [EMAIL PROTECTED] > > > > > -----Original Message----- > > > From: Moderated discussion of advanced .NET topics. > > > [mailto:[EMAIL PROTECTED] Behalf Of > > Johnny Chung > > > Sent: Monday, July 07, 2003 11:49 PM > > > To: [EMAIL PROTECTED] > > > Subject: [ADVANCED-DOTNET] ReleaseCOMObject from Managed code > > > > > > > > > I read a short article on "why not to use ReleaseComObject" > > method on > > > the Chris Brume's web log. However, it started by saying > > that the use > > > of ReleaseCOMObject will release all refcounts at once, then it > > > started explaining the method returns the number of > > refcounts and how > > > application code should call ReleaseComObject until the > > method returns > > > 0. I am confused as to whether to use the method or not. > > Can someone > > > please explain about releaseComObject method? > > > > > > > > > > > > Cheers > > > > > > Johnny Chung > > > > > > > > > > > > > > > > > ****************************************************************** > ********** > > > Esta mensagem (incluindo eventuais ficheiros anexos) pode conter > informacao > confidencial ou privilegiada. > Se nao for o destinatario pretendido, por favor contacte imediatamente o > remetente por e-mail, e apague a mensagem do seu sistema informatico. > A transmissao de mensagens por e-mail nao e absolutamente segura > ou livre de > erro: a mensagem pode ser interceptada, alterada, perdida, > destruida, chegar > ao seu destinatario num momento posterior ao pretendido ou alterada, ou > ainda com virus. O Banco Espirito Santo declina qualquer responsabilidade > por erros ou omissoes na presente mensagem que resultem das circunstancias > descritas. > Qualquer opiniao expressa na presente mensagem e imputavel a pessoa que a > enviou, a nao ser que o contrario resulte expressamente do seu > texto e que a > pessoa em causa tenha poderes para vincular o Banco Espirito Santo. > > This message and any files transmitted with it may contain confidential > information or privileged material. > If you are not the intended recipient, please notify the sender > immediately > by e-mail and delete this message from your system. > E-mail transmission cannot be guaranteed to be secure or error-free as > information could be intercepted, corrupted, lost, destroyed, > arrive late or > incomplete, or contain viruses. Banco Espirito Santo therefore does not > accept liability for any errors or omissions in the contents of > this message > which arise as a result of e-mail transmission. > Any views expressed in this message are those of the individual sender, > except where the message states otherwise and the sender is authorized to > state them to be the views of Banco Espirito Santo. > > ****************************************************************** > **********
