How large is the size of one-dimension array can be?

 

I need a large size of array buffer to store testing data in my ea.such as the code below:

 

double Buff[size];

double BuffDym[];

ArrayResize(BuffDym,size);

 

 when the value of size is to large,the compiler will come out a error said :array is too large.

I want to know the largest value of size that I can used. 

 
xhxiang:

I need a large size of array buffer to store testing data in my ea.such as the code below:

 

 

 when the value of size is to large,the compiler will come out a error said :array is too large.

I want to know the largest value of size that I can used. 

What the documentation says ?
 
angevoyageur:
What the documentation says ?

Total amount of elements in the array cannot exceed 2147483647. 

 I found this in the Docs about ArrayResize(). 

 If you try this scripts below:

 

void OnStart()
  {
//---
   int size=2000000000; // < 2147483647
   double a[];
   double b[];
   datetime c[];
   ulong d[];

   if(ArrayResize(a,size)==-1 || 
      ArrayResize(b,size)== -1 ||
      ArrayResize(c,size)== -1 ||
      ArrayResize(d,size)== -1)
      Print("resize error");
   else
      Print("ok");
      
   

  }

 

you will away get "resize error".  and if you declare a static array:

 

double a[2000000000];
double b[2000000000];
datetime c[2000000000];
ulong d[2000000000];

the compiler get error: array is too large 

 
xhxiang:

Total amount of elements in the array cannot exceed 2147483647. 

 I found this in the Docs about ArrayResize(). 

 If you try this scripts below:

 

 

you will away get "resize error".  and if you declare a static array:

 

the compiler get error: array is too large 

Of course you need to have sufficient memory to allocate such size to your arrays.

A double is 8 bytes x 2,000,000,000 = around 16 Gb only for 1 array.

 
angevoyageur:

Of course you need to have sufficient memory to allocate such size to your arrays.

A double is 8 bytes x 2,000,000,000 = around 16 Gb only for 1 array.

Is there a way to get as much as I can ? I mean some algorithm to calculate how much memory I can allocate...
Reason: