[vtkusers] Dispose to vtk objects
David Cole
dlrdave at aol.com
Tue Jun 11 10:45:01 EDT 2013
> I saw in some example that after exit dispose of
> all the objects is performed.
> Is this a must? I'm talking about Activiz wrapping,
> isn't it performed automatically?
Hi Max,
You are correct, it is performed automatically whenever the .NET
garbage collector runs.
However, some sequences of code produce networks of connected objects
which must be broken down, disconnected and destroyed in a
deterministic manner. Many times, objects that are related to the
RenderWindow in some way should be properly removed from the
RenderWindow before the window is closed or destroyed.
It's moderately frequent in writing VTK code that you'll need to
actively manage some of the objects with "early" calls to Dispose. As
soon as you do
call Dispose, though, you should immediately set the associated
variable to null as well, to remove the .NET reference hold on it.
( Speaking of Activiz, have you seen the Kickstarter campaign to update
it? It only has minutes left to go...
http://www.kickstarter.com/projects/dlrdave/activiz-net-installers-featuring-vtk-510
)
HTH,
David
More information about the vtkusers
mailing list