Skip to content
Snippets Groups Projects
Commit bf8ed1ab authored by Dan Lipsa's avatar Dan Lipsa Committed by Kitware Robot
Browse files

Merge topic 'avoid_new_delete'


0946a23a Avoid memory new on SetNumberOfTuples and delete on SetVoidArray

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Tested-by: default avatarbuildbot <buildbot@kitware.com>
Merge-request: !11640
parents 0728ecf5 0946a23a
No related branches found
No related tags found
No related merge requests found
......@@ -158,7 +158,11 @@ def numpy_to_vtk(num_array, deep=0, array_type=None):
else:
result_array.SetNumberOfComponents(shape[1])
result_array.SetNumberOfTuples(shape[0])
# We don't need to call result_array.SetNumberOfTuples(shape[0])
# because we will use result_array.SetVoidPointer
# which takes care of setting the NumberOfTuples
# Calling SetNumberOfTuples will result in a memory allocation
# that will be deleted on SetVoidPointer.
# Ravel the array appropriately.
arr_dtype = get_numpy_array_type(vtk_typecode)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment