[vtkusers] Problem with allocating memory for huge vtkImage and memory-fragmentation ?

Dženan Zukić dzenanz at gmail.com
Fri Apr 8 02:38:11 EDT 2011


If you are close to the limit of the address space (like using 1GB block on
32bit machine), it is a problem. However on 64bit system 4GB block is not an
issue.

Regards,
Dženan

On Fri, Apr 8, 2011 at 07:42, Ashika Umanga Umagiliya <aumanga at biggjapan.com
> wrote:

> Greetings all,
>
> In our application we need to load large volumedata (2000x2000x1000  - 8
> bpp).
> In the "Vtk Users Guide" I came across following  example to create
> vtkImageData.
>
> vtkImageData *id=vtkImageData::New();
> id->SetDimentions(nx,ny,nz);
> id->SetScalarTypeToUnsignedChar();
> id->SetNumberOfScalarComponents(1);
> id->AllocateScalars();
>
> //Fill in scalar values
> unsigned char *ptr=(unsigned char*)id->GetScalarPointer();
> for(int i=0;i<nx*ny*nx;i++){
>  *ptr++=i;
> }
>
> Looking at the way assigning values and the method GetScalarPointer(); , it
> seems that one block of memory is allocated for entire (nx*ny*nz) pixels.
> If it allocate entire memory block,would it cause problem with
> memory-fragmentation ?
> Or is there any other memory allocation schema ?
>
> Thanks in advance.
>
>
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110408/5237a344/attachment.htm>


More information about the vtkusers mailing list