in few hours it grows to ~2Gb. EA's DLL reports Out of Memory exception:
Test it without your DLL . . .
Are the objects released in the deinit?
no, I didn't release them - it's quite handy to restart EA, while keeping previously drawn Trendlines on the chart..
is deinit() being called when changing timeframe? init() is not called, as per logs.
thanks
I'd have to experiment. Changing a timeframe will call a clear and redraw and refresh the chart. Thinking and typing at the same time sorry. The chart is an object with sub-oject lists attached to it. To work the refresh without creating too many errors the EA must be disabled and re-enabled. Now we step into the unknown of does the chart interupt the EA process or wait for the EA tick process to end before updating the chart and will that interupt cause memory leak (unreleased function memory stack calls).
I'd have to experiment. Changing a timeframe will call a clear and redraw and refresh the chart. Thinking and typing at the same time sorry. The chart is an object with sub-oject lists attached to it. To work the refresh without creating too many errors the EA must be disabled and re-enabled. Now we step into the unknown of does the chart interupt the EA process or wait for the EA tick process to end before updating the chart and will that interupt cause memory leak (unreleased function memory stack calls).
sorry, I was wrong: deinit() and init() is happening every time I change timeframe of the chart with a mouse - as per logs. So it's full EA restart.
Is any way for EA to learn in init(), what timeframe I chose with a mouse?
About chart refresh and EA tick processing: memory leak is steady over time, while I changed timeframe just 2-3 times in an hour.You can pick up a few useful ideas from this article
sorry, I was wrong: deinit() and init() is happening every time I change timeframe of the chart with a mouse - as per logs. So it's full EA restart.
Is any way for EA to learn in init(), what timeframe I chose with a mouse?
Yes, Period() . . . .
What happened when you tried your EA without your DLL ?
no, I didn't release them - it's quite handy to restart EA, while keeping previously drawn Trendlines on the chart.
is deinit() being called when changing timeframe? init() is not called, as per logs.
- You didn't delete them in deinit() so every change creates a new set.
- Deinit() and init() are called each time. See Uninitialize reason codes - MQL4 Documentation
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I drop EA onto M30 chart of window 0. EA draws Trendlines:
and calls Delphi DLL which is doing basic logging to disk, nothing else. All works for days:
once I click and change timeframe few times to say M5 M15 back to M30, to check in different timeframes how Trendlines are drawn, memory consumption starts going up quickly:
in few hours it grows to ~2Gb. EA's DLL reports Out of Memory exception:
When I Remove EA, memory use goes down to normal:
what's wrong with changing timeframes this way, why it affects EA so much?
What else should I do when drawing those Trendlines?
it's InstaTrader v.4.0.0 Build 432, thanks!