DebugLeaksView

From KitwarePublic
Revision as of 16:06, 27 March 2012 by Patmarion (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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().



Debug leaks widget 1.png 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.


Debug leaks widget 2.png 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.


Debug leaks widget 3.png Now I have created a second exodus reader. Notice in the debug leaks widget that the class counts have doubled.


Debug leaks widget 4.png 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.


Debug leaks widget 5.png 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'.


Debug leaks widget 6.png 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.


Notes:

  • 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