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
Any ArrayResize for cExperts somewhere? A change in mSymbolsCount?
Try to add the static instance counter m_occ to CMarketInfo
*update Also you can view the id of the objects not deleted with m_id printed in constructor/destructor
And print it after delete
Thanks a lot Amir
Will try them out.
Any ArrayResize for cExperts somewhere? A change in mSymbolsCount?
Good morning Amir
ArrayResize ... done at Expert OnInit() and no changes in mSymbolCount. Currently there is only one symbol in EA, and possibly that is the one not being deleted. Other 4 instances seems to come from instantiation from Class(s) other than EA.
I have tried your suggestions and indeed there is problem with number of instantiations and deletions.
2024.06.13 09:40:54.876 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 1
2024.06.13 09:40:54.876 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 2
2024.06.13 09:40:54.876 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 3
2024.06.13 09:40:54.883 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 4
2024.06.13 09:40:55.013 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 5
2024.06.13 09:41:20.248 AlgoEA (XAUUSD,M15) CMarketInfo::~CMarketInfo(): Deleting: 4
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) CMarketInfo::~CMarketInfo(): Deleting: 3
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) CMarketInfo::~CMarketInfo(): Deleting: 2
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) CMarketInfo::~CMarketInfo(): Deleting: 1
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) void OnDeinit(const int): Total Objects Left : 1
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) 1 undeleted objects left
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) 1 object of type CMarketInfo left
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) 64 bytes of leaked memory
Below is the relevant codes.
EDIT: CExpertBase class code also included now as below
Good morning Amir
ArrayResize ... done at Expert OnInit() and no changes in mSymbolCount. Currently there is only one symbol in EA, and possibly that is the one not being deleted. Other 4 instances seems to come from instantiation from Class(s) other than EA.
I have tried your suggestions and indeed there is problem with number of instantiations and deletions.
2024.06.13 09:40:54.876 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 1
2024.06.13 09:40:54.876 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 2
2024.06.13 09:40:54.876 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 3
2024.06.13 09:40:54.883 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 4
2024.06.13 09:40:55.013 AlgoEA (XAUUSD,M15) CMarketInfo::CMarketInfo(): Instantiating: 5
2024.06.13 09:41:20.248 AlgoEA (XAUUSD,M15) CMarketInfo::~CMarketInfo(): Deleting: 4
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) CMarketInfo::~CMarketInfo(): Deleting: 3
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) CMarketInfo::~CMarketInfo(): Deleting: 2
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) CMarketInfo::~CMarketInfo(): Deleting: 1
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) void OnDeinit(const int): Total Objects Left : 1
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) 1 undeleted objects left
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) 1 object of type CMarketInfo left
2024.06.13 09:41:20.249 AlgoEA (XAUUSD,M15) 64 bytes of leaked memory
Below is the relevant codes.
So you finally tried what I said to do in post #1 four days ago and now you can see your problem and the fix is simple.
Hi Paul
I personally feel that Amir is trying to find error more logically then just simple guess work.
Now we have pin-pointed where the error is caused, but there seems to issue something else (a technical glitch or coding error) not just a matter of deleting the object, which is what you are suggesting.
May be you are reaching to conclusion too fast without realizing the real problem.
If you think deleting the object is the only solution, then look at the Expert code above, there is a command to delete, however object is still left. I will be glad if you can answer why it is still left.
Why CExpertBase instansiates CMarketInfo twice (once in it's constructor and once in OnInit()) ?
Hi Paul
I personally feel that Amir is trying to find error more logically then just simple guess work.
Now we have pin-pointed where the error is caused, but there seems to issue something else (a technical glitch or coding error) not just a matter of deleting the object, which is what you are suggesting.
May be you are reaching to conclusion too fast without realizing the real problem.
If you think deleting the object is the only solution, then look at the Expert code above, there is a command to delete, however object is still left. I will be glad if you can answer why it is still left.
Why CExpertBase instansiates CMarketInfo twice (once in it's constructor and once in OnInit()) ?
Also if still not helping, remove the second line in the attached pic for more correct delete printing
CMarketInfo twice
Hi Amir
Yes I agree, there was a mistake to declaring it twice, and this fact was hidden behind so many other lines of code in between. Here when I posted it, I removed unrelated code, however still failed to recognize it :)
THANKS A LOT for pin-pointing the exact cause and resolving it too.
Allocating an object twice and saving them in the same pointer makes the first object lost in memory and undeletable.
this is technical information I was not aware of earlier. But logically also it is not correct to declare something twice.