|
|
Line 1: |
Line 1: |
− | If you are getting leaks for a vtkObject but can't figure out where it's coming from, you can try making a change to the constructor for that class and checking the debug output (warning, it can be verbose). What you will see from the following type of change is instances that are created but never destroyed. Then you can add other debug statements in your code and narrow down which instances aren't being deleted.
| + | <big>'''Note:''' We are migrating this content to the slicer.org domain - <font color="orange">The newer page is [http://www.slicer.org/slicerWiki/index.php/Slicer3:VTK_Leak_Debugging here]</font></big> |
− | | |
− | Add this at the beginning of the constructor:
| |
− | this->DebugOn();
| |
− | vtkDebugMacro("constructing");
| |
− | | |
− | and this in the destructor:
| |
− | vtkDebugMacro("destructing");
| |
− | | |
− | For example, these changes helped me find an extra instance of vtkPoints
| |
− | | |
− | <pre>
| |
− | // Construct object with an initial data array of type float. | |
− | vtkPoints::vtkPoints(int dataType)
| |
− | {
| |
− | this->DebugOn();
| |
− | vtkDebugMacro("constructing");
| |
− | this->Data = vtkFloatArray::New();
| |
− | this->Data->Register(this);
| |
− | this->Data->Delete();
| |
− | this->SetDataType(dataType);
| |
− | | |
− | this->Data->SetNumberOfComponents(3);
| |
− | | |
− | this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = 0.0;
| |
− | this->Bounds[1] = this->Bounds[3] = this->Bounds[5] = 1.0;
| |
− | }
| |
− | | |
− | vtkPoints::~vtkPoints()
| |
− | {
| |
− | vtkDebugMacro("destructing");
| |
− | this->Data->UnRegister(this);
| |
− | }
| |
− | </pre> | |
Revision as of 19:05, 20 May 2008
Home < Slicer3:VTK Leak DebuggingNote: We are migrating this content to the slicer.org domain - The newer page is here