[vtkusers] Copying memory instead of resizing allocation in vtkDataArrayTemplate::Resize()
Mathieu Malaterre
mathieu.malaterre at kitware.com
Tue Oct 25 10:12:34 EDT 2005
Jens,
Could you submit a feature request, in our bug tracker at:
http://vtk.org/Bug
Thanks.
Mathieu
Jens wrote:
> Hi
> I would like to read grids with millions of cells and developed a reader for
> my private netCDF file format.
>
> I thought reading the file in chunks of 100000 cells. That for I create a
> vtkDoubleArray to add all nodes of the 100000 cells and resize that
> vtkDoubleArray each time I read the next chunk of cells.
>
> I had a look at the function resizing the vtkDoubleArray because I have to
> make sure not to use more memory than needed. ( Its "Resize()" in
> vtkCommon/vtkDataArrayTemplate.txx line 273 in Vtk-5-branch )
>
> This function uses "memcpy" instead of "realloc" to resize the double array.
> ( http://www.codecogs.com/reference/stdlib.h/malloc.php?alias=realloc
> http://www.codecogs.com/reference/string.h/memcpy.php?alias=memcpy )
>
> That means that each time Resize get used the data is twice in memory for a
> short time. That´s slow and needs double memory.
>
> What´s wrong with realloc ?
>
> Greetings
> Jens
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list