appacki:
void OnStart(){ trendObject *trend = new trendObject(); trend = findTrend("EURUSD", PERIOD_D1, 13); delete trend; } trendObject *findTrend(string symbol, ENUM_TIMEFRAMES _TIMEFRAME_, int pos){ trendObject *trendObj = new trendObject(); //this object makes problem return trendObj; }
You created 2 objects and deleted 1.
You deleted an object you created inside the function, but you didn't delete the object you created before calling the function.
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
this code is returning an object to main function but there is memory leak and it gets enormous when its in a loop
2025.11.19 10:28:25.180 testSmall (EURUSD,H1) 1 undeleted dynamic object found:
2025.11.19 10:28:25.180 testSmall (EURUSD,H1) 1 object of class 'trendObject'
2025.11.19 10:28:25.180 testSmall (EURUSD,H1) 128 bytes of leaked memory found
how can i return the object and release memory after function return?