[vtkusers] Problem with allocating memory for huge vtkImage and memory-fragmentation ?
Ashika Umanga Umagiliya
aumanga at biggjapan.com
Fri Apr 8 01:42:02 EDT 2011
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110408/1d691cf5/attachment.htm>
More information about the vtkusers
mailing list