I revealed that #include directive is ignored if repeated, i. e.
int OnStart() { #include <dummy.mqh> #include <dummy.mqh> #include <dummy.mqh> #include <dummy.mqh> }
works same as
int OnStart() { #include <dummy.mqh> }
Though it is very welcome behaviour if you have class declarations in separate files, it is not mentioned in the help file.
Are you asking a general programming question like make sure to "delete dynamically allocated memory" || "limit the use of recursive functions". Or are you referring to a memory leak bug within the beta?
Definitively the former one. I do not have any experience with taking care of unused object references, as my background comes from JAVA. So I mean it, that I appreciate a hint for finding leaked objects after I get the generic warning message (if such a hint exists). Right now I am trying to identify the class of the leaked object from number of bytes the warning prints out.
Its incomplete compared to mt5. There should be another line which says the Class name. Hopefully they'll add this soon enough.
Well, the leak hunting turned to be really annoying... more than I expected.
I spent some effort on creating a tool but I did not succeed at all. Though I found out that I could redefine the new/delete statements, I realized I had nothing to replace them with. If they were functions with parenthesis, then it would be quite simple, but unfortunately they are statements. I could create a wrapper around new/delete statements to register them, but it would be very painful solution that has no future.
If anyone has some experience how to detect the source of the leak, please drop a note.
Well, the leak hunting turned to be really annoying... more than I expected.
I spent some effort on creating a tool but I did not succeed at all. Though I found out that I could redefine the new/delete statements, I realized I had nothing to replace them with. If they were functions with parenthesis, then it would be quite simple, but unfortunately they are statements. I could create a wrapper around new/delete statements to register them, but it would be very painful solution that has no future.
If anyone has some experience how to detect the source of the leak, please drop a note.
Maybe these articles (for mql5 but the same apply to new mql4) can help you to find a solution :
The Order of Object Creation and Destruction in MQL5
Using the Object Pointers in MQL5Maybe these articles (for mql5 but the same apply to new mql4) can help you to find a solution :
The Order of Object Creation and Destruction in MQL5
Using the Object Pointers in MQL5
Thank you for your note.
Unfortunately it does not seem to help with treating leaks, it only explains why they happen.
The only solution I have been using so far is coding a unit test for every piece of code I create, and running Unit tests frequently during development. So if the leak appears, I may try to isolate the testcase that caused it. However some tests are pretty complex, so it is not easy solution for the purpose. And the editor is a real pain.
How to distinguish the new syntax?
I feel I need a different word for referencing the "upcoming" syntax and the "original" syntax. It seems that MQ do not care about official names and keep pretending they are compatible.
So it looks like we have to find appropriate names ourselves. Any suggestions? MQL4 V2, OMQL4 (i.e.Object-), MQL4.1 ...?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
It's been a while since the Beta has been released, and I spotted a note somewhere, that the regular release might appear in a middle of January. Though I doubt it will happen, perhaps a few coders may feel interest in sharing ideas and problems they learnt with the Beta.
Is it already meaningful to start a discussion about the new MQL4 source syntax, editor, compiler, patterns, OOP, or whatever related?
Please no bug reports, no cries, only constructive discussion in this topic.