[vtkusers] memory usage with python+vtk

white colin john cjwhite1 at ews.uiuc.edu
Fri Jun 7 09:41:38 EDT 2002


I'm writing some simple vtk scripts using python, and I have a simple gui
to control some aspects of it.  I am new to both vtk and python, so my
implementation is not the most sophisticated.  When some changes are made,
I remake some vtk objects and throw away the old ones.  One thing I'm not
sure about is reclaiming the memory used for the objects I no longer
need.  In the example code Cone2 distributed with vtk4.0 from the kitware
site, there's this python code:

#
# Free up any objects we created
#
cone = None
coneMapper = None
coneActor = None 
ren1 = None
renWin = None

in the tcl version:

#
# Free up any objects we created
#
vtkCommand DeleteAllObjects

My question is, does setting the variable referencing a vtk object to None
definitely reclaim the resources used?  Is there some interface in python
for destroying these objects which is more explicit, such as that used in
the tcl example?  Any advice is welcome.

-colin




More information about the vtkusers mailing list