How can I release Indicator memory (RAM)? - page 2

To add comments, please log in or register
Sharon Aharonov
222
Sharon Aharonov  
Lorentzos Roussos:
(just saw the image) 
You probably initialize arrays in function calls and then dump them .
Init these arrays once on start (since they have a static size) , never free or resize them (only on Deinit).
Use precalculations for live data , and normal calculations on new bars .
(example : MovingAverage 14 , on a new bar calculate the 13 bars sum (upto bar 1) ,and have the 14th bar fluctuate live )

Hi Lorentzos, all my major/general arrays are initializing once (on start) and I just update the values in them for the new calculations data (and yes, all precalculations that I can do just once, I do just once)

I'm still saying, the problem is that the usage memory doen't get free when I emptied the arrays,

and this is the main problem here, why the usage memory does not get free? 

Mladen Rakic
139673
Mladen Rakic  

There is no such issue in metatrader (the "I'm still saying, the problem is that the usage memory doen't get free when I emptied the arrays,")

If you are having the issue with memory, you are having it due to your code. Since you are not posting it (the complete code that is causing you an issue), the only way you can solve it is to recheck your code again and again till you find the partd of the code that is causing you an error. Saying anything else is wild guessing without any purpose

Lorentzos Roussos
30587
Lorentzos Roussos  
Sharon Aharonov:

Hi Lorentzos, all my major/general arrays are initializing once (on start) and I just update the values in them for the new calculations data (and yes, all precalculations that I can do just once, I do just once)

I'm still saying, the problem is that the usage memory doen't get free when I emptied the arrays,

and this is the main problem here, why the usage memory does not get free? 

Okay , so you initialize once , then dump the arrays when the chart is not active , and then when the chart becomes active what happens ?(thats the issue probably)

Sharon Aharonov
222
Sharon Aharonov  
Lorentzos Roussos:

Okay , so you initialize once , then dump the arrays when the chart is not active , and then when the chart becomes active what happens ?(thats the issue probably)

When becomes active again, I refill the arrays again.

The problem is not in this step, it's at the previous step -> when I dump (or more accurate, eptied) the arrays, I would expect to see a decrease in memory usage, but there isn't.

Lorentzos Roussos
30587
Lorentzos Roussos  
Sharon Aharonov:

When becomes active again, I refill the arrays again.

The problem is not in this step, it's at the previous step -> when I dump (or more accurate, eptied) the arrays, I would expect to see a decrease in memory usage, but there isn't.

Yeah ,because the chart that became active just re-filled its own arrays.

Also , "I refill the arrays again" = you are not initializing once ,you are performing redundant calculations + steps
Sharon Aharonov
222
Sharon Aharonov  
Mladen Rakic:

There is no such issue in metatrader (the "I'm still saying, the problem is that the usage memory doen't get free when I emptied the arrays,")

If you are having the issue with memory, you are having it due to your code. Since you are not posting it (the complete code that is causing you an issue), the only way you can solve it is to recheck your code again and again till you find the partd of the code that is causing you an error. Saying anything else is wild guessing without any purpose

Well, I don't think that Metatrader is bugless...

The function IndicatorRelease() that added to the MQL5 perhaps was designed precisely for this problem (although I do not really know for what it was designed. I don't working with MT5)

BTW, I didn't put here the code because It's a lots of code lines with lots of functions, not something that can be presented clearly, So I focus on the very idea of the problem.

Sharon Aharonov
222
Sharon Aharonov  
Lorentzos Roussos:

Yeah ,because the chart that became active just re-filled its own arrays.

Also , "I refill the arrays again" = you are not initializing once ,you are performing redundant calculations + steps

What I ment by "once" is that the arrays initializing just once when the Chart is init. After that I'm playing with the existings arrays.

The calculations does not uses the memory, they uses the CPU. My problem is with the memory.

At the first, I didn't perfom the redundant calcultations, because I didn't thought to play with the arrays while Chart focus/unfocus, but I'm trying now to solve the memory issue with this Chart focus/unfocus method.

I prefer the redundant calcultations instead of the memory usage problem, because the CPU usage for my tool is quiet ok, but the Memory usage is a kind of catastrophe.

Lorentzos Roussos
30587
Lorentzos Roussos  
Sharon Aharonov:

What I ment by "once" is that the arrays initializing just once when the Chart is init. After that I'm playing with the existings arrays.

The calculations does not uses the memory, they uses the CPU. My problem is with the memory.

At the first, I didn't perfom the redundant calcultations, because I didn't thought to play with the arrays while Chart focus/unfocus, but I'm trying now to solve the memory issue with this Chart focus/unfocus method.

I prefer the redundant calcultations instead of the memory usage problem, because the CPU usage for my tool is quiet ok, but the Memory usage is a kind of catastrophe.

I see . ArrayResize is your issue

Sharon Aharonov
222
Sharon Aharonov  
Lorentzos Roussos:

I see . ArrayResize is your issue

Yep. And right now it seems that it's not doing it's job as it should..

Mladen Rakic
139673
Mladen Rakic  
Sharon Aharonov:

Well, I don't think that Metatrader is bugless...

The function IndicatorRelease() that added to the MQL5 perhaps was designed precisely for this problem (although I do not really know for what it was designed. I don't working with MT5)

BTW, I didn't put here the code because It's a lots of code lines with lots of functions, not something that can be presented clearly, So I focus on the very idea of the problem.

Whatever ... good luck.
123
To add comments, please log in or register