Features of the mql5 language, subtleties and tricks - page 265

 

Ah, it's probably because 1Mb = 2^20 = 1048576 bytes

then everything is fine.

But still it is not clear why each iteration of memory allocation increase causes a shift by 1 unit .
 
Nikolai Semko #:

Ah, it's probably because 1Mb = 2^20 = 1048576 bytes

Then it's fine.

Well, the main thing is that the redistribution happened where it was expected - the very last resize in your code. And I don't really care about the accuracy of memory footprint measurement.

 
fxsaber #:

Tick Multicurrency Tester. Request ticks by one symbol (50% RAM), then filter them (10% RAM). The same for other symbols. If ticks are not physically shrunk in the filter, there is a lack of memory at the stage of data preparation.

I.e. a separate array for each symbol and filtering in the source array?

 
Aleksey Vyazmikin #:

I.e. a separate array for each character and filtering in the original array?

Sure.

 
fxsaber #:

Of course.

And what is the advantage if you can get ticks in one array from all symbols, filter them and then transfer them to separate arrays for each symbol, create an array with the required size at once? I don't see what the memory advantage would be.

 
Aleksey Vyazmikin #:

And what is the advantage, if you can get ticks in one array from all symbols, filter them and transfer them to separate arrays for each symbol, create an array with the required size at once? I don't see what the memory advantage would be.

how ?

 
Maxim Kuznetsov #:

How's that?

In a loop?

 
Aleksey Vyazmikin #:

And what is the advantage, if you can get ticks in one array from all symbols, filter them and transfer them to separate arrays for each symbol, create an array with the required size at once? I don't see what the memory advantage would be.

There are 20 gigabytes of memory. We need a multicurrency array for five symbols. The tick history of each one consumes 5 gigs.

For each symbol we take 5 gigs of its history and turn it into 0.5 gigs after filtering.

 
Aleksey Vyazmikin #:

In a loop?

Well, then where is the gain...whether to pump into different arrays one by one, or into one.

 
Maxim Kuznetsov #:

Well, then where's the gain...it's either pumping into different arrays one at a time or into one.

That's what I'm trying to understand - what is the point in increasing the array on demand, if you can set the maximum required in the current situation....