You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
since a few days my tester need a lot of memory. I never had a problem with memory since these few days. I deactivated all cores except 1.
The system had run out of memory very quick, after reducing a lot of Prints() in the EA and using a shorter EA-Name (!?) I think I can run an optimization again.
But only 1 core, only 2 years testing 19GB of memory usage is still crazy.
I did never had these problems, I tested periods of 20 years without problems, why now? Where are these problems coming from?
System: ASRock B450M Pro4 / AMD Ryzen 3400G / 64GB
Problems of the high memory usage: freezing or self-killing of each application, second screen blanks, nothing clickable, sometimes unwanted reboot.
Do somebody have experience with memory consumption like this and get it solved?
yours sincerely
sb
Hello,
since a few days my tester need a lot of memory. I never had a problem with memory since these few days. I deactivated all cores except 1.
The system had run out of memory very quick, after reducing a lot of Prints() in the EA and using a shorter EA-Name (!?) I think I can run an optimization again.
But only 1 core, only 2 years testing 19GB of memory usage is still crazy.
I did never had these problems, I tested periods of 20 years without problems, why now? Where are these problems coming from?
System: ASRock B450M Pro4 / AMD Ryzen 3400G / 64GB
Problems of the high memory usage: freezing or self-killing of each application, second screen blanks, nothing clickable, sometimes unwanted reboot.
Do somebody have experience with memory consumption like this and get it solved?
yours sincerely
sb
Two options:
Two options:
Hello,
1. Looking here I have the latest (stable?) release: https://www.metatrader5.com/en/releasenotes
EDIT: Updated build 2776 (beta). Same issue.
2. How I should find a memory leak? My EA is not saving a lot of data. And why the memory usage is increasing over time, it did not stop anywhere, unlesss the Optimization is stopped memory consumption is increasing till the end.
Why MT5 is written like this? I don't know any other application which causes system crashes like this in 2021.
Update: 11.02.2021 6:00:
By reducing a lot of prints I reduced the memory consumption for a single tester run from 1-2GB to 400-500MB but running in optimization mode there is no difference. Every host gets killed.
Hello,
1. Looking here I have the latest (stable?) release: https://www.metatrader5.com/en/releasenotes
EDIT: Updated build 2776 (beta). Same issue.
2. How I should find a memory leak? My EA is not saving a lot of data. And why the memory usage is increasing over time, it did not stop anywhere, unlesss the Optimization is stopped memory consumption is increasing till the end.
Why MT5 is written like this? I don't know any other application which causes system crashes like this in 2021.
Update: 11.02.2021 6:00:
By reducing a lot of prints I reduced the memory consumption for a single tester run from 1-2GB to 400-500MB but running in optimization mode there is no difference. Every host gets killed.
Show your MQL5 code.
Show your MQL5 code.
Hello, thank you for your time.
I found the problematic line:
changing to
solves to memory problem.
I am softwareengineer for 15 years, so I wrote the line like I would do in php or java.
Why the object is not completely removed from memory and how I write this line so I REALLY, REALLY get a new clean object ?
I suggest to add Print statements or use the debugger with a breakpoint in the constructor to see how this happens.
When you create class object pointers with new you should always ensure they are deleted when you are finished with them, at the very least in Deinit() to avoid memory leaks.
Also, do not try and delete the pointer if it does not exist as that will give you another set of problems.
This line creates the CurrentBarData instance cb, then creates an anonymous instance via new, and assigns it by value to cb. After this line, there's no access to that anonymous instance left. Dang, memory leak.
I suggest to add Print statements or use the debugger with a breakpoint in the constructor to see how this happens.
Hello,
"anonymous instance via new" - How would someone access it? Isn't it always a memory leak? Why the language allows that?
When you create class object pointers with new you should always ensure they are deleted when you are finished with them, at the very least in Deinit() to avoid memory leaks.
Also, do not try and delete the pointer if it does not exist as that will give you another set of problems.
Hello,
how would I access something without an handle or variable name?
the line is now:
I have to say, I really don't like this syntax. cb is a variable name, not a function - why "()" on the variable name and not on the class name or constructor?
I also find out accessing some methods multiple times take longer than saving it to a variable and access it from there:
Pro of all this searching: The EA got really fast. I reduced the running time of the EA to about 10%.
But anyway, thank you, to all of you!
solves to memory problem.
I am softwareengineer for 15 years, so I wrote the line like I would do in php or java.
Why the object is not completely removed from memory and how I write this line so I REALLY, REALLY get a new clean object ?
That is not an assignment; it's initialization of a common (globally declared), or static variable with a constant. They work exactly the same way in MT4/MT5/C/C++.
They are initialized once on program load.
They don't update unless you assign to them.
In C/C++ you can only initialize them with constants, and they default to zero. In MTx you should only initialize them with constants. There is no default in MT5, or MT4 with strict (which you should always use).
MT4/MT5 actually compiles with non-constants, but the order that they are initialized is unspecified and
Don't try to use any price or server related functions in OnInit (or on load), as there may be no connection/chart yet: