How to allocate a huge amount of memory

Deal all, I’m writing an application for raw image processing but I cannot allocate the necessary block of memory, the following simple code gives me an allocation error.

double (*test)[4];
int block = 32747520;
test = new double[block][4];

off course with smaller block size (i.e. int block = 327475;) it works fine.
Is there an allocation limit? How it is possible to deal with big blocks of memory?
Which compiler do you use?
Are you sure your computer have 1000 Mb of memory avaliable at that time? If so, I bet, you have 32bit machine.

If you do have 32 bit machine, then answer is simple: your memory are fragmented in 2 (or more) parts none of which is larger than 1000 Mb. So you cannot fit your array here. Use some smart structure which stores its info in smaller chunks (like deque).

On my machine your code compiles and works BTW.
Thanks a lot for your help, you are right, with only 4Gb of memory I do not have enough space for storing such a huge array.

I will try to allocate 4 different arrays.
Topic archived. No new replies allowed.