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.
Now I have opened some data using the exodus reader. In the debug leaks widget, I typed 'Exodus' into the regexp filter box. Only classes with names that match the regexp filter are displayed.
Now I have created a second exodus reader. Notice in the debug leaks widget that the class counts have doubled.
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 widget is available in VTK 5.10
- code to embed the widget into paraview is available in the 13024-debug-leaks-view branch of git://paraview.org/stage/ParaView.git