What happened to array sizing?!? - page 2

 
Mohammad Hossein Sadeghi:
You should check the return value of ArrayResize, if it is false, then check for error using GetLastError.

As the 0 result projects, the ArrayResize return value is -1.

5000x5000 is only 25.000.000, not 2.147.483.647.

 

Something very fishy happened to MT4.

Total chaotic array-handling, sudden crashes.

double array[][5000];
ArrayResize(array,5000);
Print(ArraySize(array));

The above code gave 0. After restarting the MT4, it gave 25.000.000. How is it possible?!

I am sure MetaQuote$ changed something in array-handling, of course it is undocumented.

Is it a joke that one cannot define for example a 7000x5000 array?! How?!

 

Guys,

Can anyone confirm that in 1320 build it is impossible to define an array with 10.000x10.000 elements?

double array[10000][10000];
 
#property strict
#property indicator_chart_window

//
//
//

#define _size1 25000 // Or 10000 for your example
#define _size2 10000

double array[_size1][_size2];

//
//
//

int OnInit(void)
{
   return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   int size1 = ArrayRange(array,0);
   int size2 = ArrayRange(array,1);
         Comment("Dimension 1 size ",size1,"\n",
                 "Dimension 2 size ",size2,"\n"
                 "Total size : ",size1*size2);
   return(rates_total);
}
For the rest, read the manual as of what is the maximal size of arrays (and why is it so)
 
Mladen Rakic:
For the rest, read the manual as of what is the maximal size of arrays (and why is it so)

Well, I ran your code: global initialization failed.

Files:
pic.png  7 kb
 
linux80s:

Guys,

Can anyone confirm that in 1320 build it is impossible to define an array with 10.000x10.000 elements?

works fine at a global level 

but not at a local level where there seems to be a limit of 65529 elements in total.

 
Paul Anscombe:

works fine at a global level 

but not at a local level where there seems to be a limit of 65529 elements in total.

Thanks for the answer.

Is there any documentation about this 65529 limit? I think it is something new.

Can I ask you to try out Mladen's code above? Can you confirm the " global initialization failed" error?

What happened to array sizing?!?
What happened to array sizing?!?
  • 2021.03.15
  • www.mql5.com
Guys, there are strange things in MT4 with array sizing that never happened before...
 
linux80s:

Well, I ran your code: global initialization failed.

No error - none whatsoever. Used the code from my example a few posts ago


all the best

 
Mladen Rakic:

No error - none whatsoever. Used the code from my example a few posts ago


all the best

Very strange. I ran it with 2 MT4 instances and got the global initialization error on both of them. Thanks

 
linux80s:

Very strange. I ran it with 2 MT4 instances and got the global initialization error on both of them. Thanks

Most probably you have low resources during runtime.