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?
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
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.
Yeah ,because the chart that became active just re-filled its own arrays.
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.
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
Yep. And right now it seems that it's not doing it's job as it should..