[vtkusers] Problem with allocating memory for huge vtkImage and memory-fragmentation ?
Ashika Umanga Umagiliya
aumanga at biggjapan.com
Fri Apr 8 05:24:32 EDT 2011
Thanks Dženan,
I am using MinGW and QT Opensource , so I am restricted to 32Bit.
Before using vtkImageData , I used simple data-structure that allocates one
memory block for each Z-Slice,(not a continuous block for the entire volume
).That helped me to avoid the memory fragmentation.
Now I moved to vtkImagaData.Does it always allocate one
large continuous block or is there any flag to change memory allocation
scheme?
Thanks
2011/4/8 Dženan Zukić <dzenanz at gmail.com>
> 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/8b7ab0b3/attachment.htm>
More information about the vtkusers
mailing list