[vtkusers] VtkIdList and SetArray, allocation error
Andy Bauer
andy.bauer at kitware.com
Fri Apr 28 14:01:03 EDT 2017
I haven't looked at the vtkIdList::SetArray() method but I wonder if this
has to do with bad memory use or freeing. Maybe vtkIdList assumes that the
memory will not be freed and in your script Python is garbage collecting
the memory. Not 100% sure on this but that's where I'd first look.
On Fri, Apr 28, 2017 at 1:53 PM, foufara via vtkusers <vtkusers at vtk.org>
wrote:
> Hi All,
>
> First, thank you Kitware for VTK ! It is really great ! A real pleasure to
> use it in my everyday work.
>
> I'm using vtk 7.1.0 with Python bindings on a Mac with Sierra (OS 10.12).
>
> Since quite recently (VTK 7.0 ?), vtkIdList has a new method SetArray which
> should allow us to link it to an numpy array.
> I suppose that this should enable us to create large vtkIdList more
> efficiently than when using InsertNextId or another similar method (like
> when using numpy_support for vtkDataArrays)
>
> So I tried something like this :
>
> a=np.arange(10)
> l=vtk.vtkIdList()
> l.SetArray(a,len(a))
> print l.GetNumberOfIds()
> for i in range(l.GetNumberOfIds()):
> print i,l.GetId(i)
>
> It seems to work fine, but when I quit python, I get en error message
> saying
>
> "Python(13731,0x7fff9714b3c0) malloc: *** error for object 0x7fe9611a4c80:
> pointer being freed was not allocated"
>
> And I really don't know how to prevent this.
> I tried to call the Allocate or the SetNumberOfIds methods first. But this
> does not change anything.
>
> Besides, the error does not occur everytime.
>
> Can you help me on that ? Try that code on another OS (several times) ?
>
> Thank you for your help !
>
> Raphaël
>
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.
> com/VtkIdList-and-SetArray-allocation-error-tp5743017.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170428/5354ba19/attachment.html>
More information about the vtkusers
mailing list