[vtkusers] Unable to allocate a large size of memory with VtkUnsignedShortArray;

Sean McBride sean at rogue-research.com
Fri Aug 28 11:32:32 EDT 2009


On 8/28/09 8:11 AM, E.R said:

>I am using this command to allocate a large size of memory,
>so after i can load a volume of Images.
>
>VtkUnsignedShortArray array->SetNumberValues(512*512*1600);

That's about 512*512*1600*2 bytes = 800 MiB.  Is your process 32 bit or
64 bit?  If the former, such an allocation could fail easily enough if
your process's heap is sufficiently fragmented.

>But I get an exception error "Unable to allocate ....... elements of
>size 2 bytes"

Did you put a breakpoint to catch the failure?  I'm guessing malloc/new
failed to allocate the memory.

>Although it seems that my available virtual space of memory is 1Giga!

That's not a lot.

>Why I cant allocate such as amount of memory?? Can somebody give me a
>logical case and explain why is this happend?
>Any Solution?

Use the 64 bit process.

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada





More information about the vtkusers mailing list