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

John Drescher drescherjm at gmail.com
Fri Aug 28 11:27:29 EDT 2009


---------- Forwarded message ----------
From: John Drescher <drescherjm at gmail.com>
Date: Fri, Aug 28, 2009 at 11:27 AM
Subject: Re: [vtkusers] Unable to allocate a large size of memory with
VtkUnsignedShortArray;
To: "E.R" <frantic_tictoc83 at yahoo.gr>


2009/8/28 E.R <frantic_tictoc83 at yahoo.gr>:
> Hello,
>
> 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);
>
> But I get an exception error "Unable to allocate ....... elements of size 2 bytes"
>
> Although it seems that my available virtual space of memory is 1Giga!
>
> Why I cant allocate such as amount of memory?? Can somebody give me a logical case and explain why is this happend?
> Any Solution?
>

Most likely there was not an 800MB plus block of contiguous memory
free. Remember unless you compile your 32 bit application with
LARGEADDRESSAWARE (google for that) you get at maximum a 2GB address
space for your program (regardless of how much ram or page file you
have). You may think this is large enough however .dlls load inside
this 2GB address space and they do so in a fragmented way so at the
start the largest contiguous block you usually can allocate is 1.2GB.
If you have already have a large block of memory allocated to the
source image there probably isn't a block big enough to store your
array.

John



-- 
John M. Drescher



More information about the vtkusers mailing list