Skip to content
Snippets Groups Projects
Commit 0946a23a authored by Dan Lipsa's avatar Dan Lipsa
Browse files

Avoid memory new on SetNumberOfTuples and delete on SetVoidArray

parent e3cb38a1
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