This page demonstrates the vtkQtDebugLeaksView widget. The widget is designed to work out of the box with any VTK+Qt application- just construct the widget and call show().
Here I have opened a new paraview session. The debug leaks widget is displayed in the window on the right. The widget contains a table that displays the name and number of instances of every vtk object that is alive in memory.
The debug leaks widget also contains a reference count table. The reference count table is initially hidden. There is a slider handle that will expand it. When a class name is selected in the class count table, the reference count table will display the reference count of each instance of the class.
When vtk python wrapping is enabled, the debug leaks widget has extra powers. By double clicking a pointer value in the reference count table, the vtk object for that pointer will be added to the python context under the variable name 'obj'. Now you can use python to inspect the object. If you double click a class name in the class count table, all instances of that class will be added to the python context as a list under the variable 'objs'.
Be careful when using python. Here I have deleted both exodus readers from the paraview pipeline browser, but the debug leaks view still shows that some of the exodus objects are alive. This is because python is holding a reference to one the objects. You need to type 'del obj' into the python console for python to give up its reference.
- vtk objects constructed before the debug leaks widget is instantiated are not counted
- the vtk code is available in the qt-vtk-debug-leaks-view branch of git://github.com/patmarion/VTK.git
- code to embed the widget into paraview is available in the qt-vtk-debug-leaks-view branch of git://github.com/patmarion/ParaView.git