ReleaseComObject or =null

  • Thread starter Thread starter mamin
  • Start date Start date
M

mamin

What is the difference between writtinig
System.Runtime.InteropServices.Marshal.ReleaseComObject(ob)

and writting ob=null ?. What will happen with my object in memory after
those operations?
 
What is the difference between writtinig
System.Runtime.InteropServices.Marshal.ReleaseComObject(ob)
and writting ob=null ?.

The former decrements the internal reference count of the RCW and
possibly releases the underlying COM object.

The latter just sets your reference to the object to null, it doesn't
affect the object itself in any way (though it may become eligible for
garbage collection some time in the future).

What will happen with my object in memory after
those operations?

It depends on of there are other references to the same object.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top