The MapScalars() methods leak in Python
When called from Python, the MapScalars()
methods leak the vtkUnsignedCharArray
that they return. To avoid the leak, they need the VTK_NEWINSTANCE
hint.
These methods appear in vtkScalarsToColors
and vtkMapper
. In addition to adding the hint, the wrappers can be made to warn if they encounter an unhinted MapScalars()
method that returns a VTK array.
In fact, any VTK method that returns a VTK object but isn't a getter (i.e. doesn't start with Get) has a fair probability of needing a hint.
Ref: https://discourse.vtk.org/t/retrieve-the-mapped-colors-from-vtkopenglpolydatamapper/12760
Edited by David Gobbi