VTK Delete () and Data Deletion

I was looking at VTK 5.4.2 code and cannot figure out how the Delete () function works. I mean, the Delete () function is located in vtkObjectBase and is virtual, but through what chain of commands does the destructor of the vtkDoubleArray class execute (for example)?

Regards,

mightydodol

+3
source share
3 answers

vtkObjectBase Delete () will call UnRegisterInternal. If the ReferenceCount classes are less than or equal to 1, it will call delete on the class.

+6
source

This is a kind of garbage collector.

If you look at vtkObjectBase, there are three functions: Register, UnRegister and Delete. These are the ones that do reference counting.

, . , . ref. count 0, . New(), , 0. , , , ref. . () - UnRegister().

(, vtkPolyData ), , (), . , () , .

, UnRegisters, (, vtkRenderer vtkRenderWindow), .

+5

Also: you do not need to call Delete () often. You can almost always use vtkSmartPointer.

+1
source

Source: https://habr.com/ru/post/1716274/


All Articles