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
 
Back
Top