Hi,
my EA seems to have a memory leak since after a while it crashes with "out of memory". How can I figure out which statement in my EA consumes memory and does not release it afterwards?
In my EM I have a function which is frequently invoked and which contains the following code:
May it be possible that memory is lost here? If so, how can I release it again?
Best,
Chris
Hi, This sounds similar to this: https://www.mql5.com/en/forum/12809
So I believe that it might be caused by a bug if you are releasing the indicator handle somewhere in your code. If you are maybe you could try to remove this process from your code and see if that helps :)
Candles
- www.mql5.com
Hi, This sounds similar to this: https://www.mql5.com/en/forum/12809
So I believe that it might be caused by a bug if you are releasing the indicator handle somewhere in your code. If you are maybe you could try to remove this process from your code and see if that helps :)
Candles
I did some more debuggin. My problem is the following code that is inside a frequently invoked function:
double high[]; double low[]; int copiedDataCountHigh = CopyHigh(currentSym, InpPeriod, 0, DonchianPeriod, high); int copiedDataCountLow = CopyLow(currentSym, InpPeriod, 0, DonchianPeriod, low);
When I remove the invocation of CopyHigh and CopyLow than I have no "out of memory" errors.
Is there a problem with non-released memory? If so, how can I release it? I tried ArrayFree() but this did not work.
Try to limit the array size of high[]/low[]:
double high[1000]; double low[1000]; int copiedDataCountHigh = CopyHigh(currentSym, InpPeriod, 0, DonchianPeriod, high); int copiedDataCountLow = CopyLow(currentSym, InpPeriod, 0, DonchianPeriod, low);
Try to limit the array size of high[]/low[]:
This really sounds related to my problem that Candles mentioned earlier on.
So far the service desk status is "we reproduced it and are working on it".
Hopefully, once the solve this issue, both of our problems are gone.
This really sounds related to my problem that Candles mentioned earlier on.
So far the service desk status is "we reproduced it and are working on it".
Hopefully, once the solve this issue, both of our problems are gone.
This does not help. Even if I limit the array size to 20, I get "out of memory" after a while.
Can you post a code that compiles and reproduce your issue ?
This is the code in short resulting after approx. 6 min running to an out of memory:
input int DonchianPeriod=20; //Period of averaging input ENUM_TIMEFRAMES InpPeriod=PERIOD_D1; // Period string currentSymbol; int OnInit() { while(true) { for(int i = 0; i < SymbolsTotal(true); ++i ) { currentSymbol = SymbolName(i, true); Print(currentSymbol); checkDonchian(currentSymbol); Sleep(1000); } Sleep(1000); } //--- return(INIT_SUCCEEDED); } int checkDonchian(string currentSym) { double SsMax=0,SsMin=0; double high[]; double low[]; int copiedDataCountHigh = CopyHigh(currentSym, InpPeriod, 0, DonchianPeriod, high); int copiedDataCountLow = CopyLow(currentSym, InpPeriod, 0, DonchianPeriod, low); return 0; }
This is the code in short resulting after approx. 6 min running to an out of memory:
Are you talking of 6 min on a live chart ?
I mean when I attach the EA to a chart it crashes after about 6 minutes (depends on current system usage). Can you reproduce it?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
my EA seems to have a memory leak since after a while it crashes with "out of memory". How can I figure out which statement in my EA consumes memory and does not release it afterwards?
In my EM I have a function which is frequently invoked and which contains the following code:
May it be possible that memory is lost here? If so, how can I release it again?
Best,
Chris