cTrader momory leaks - clean run
cTrader momory leaks - clean run
30 Jan 2023, 01:07
Hello,
The screenshot below shows the merory used by cTrader over time.
This was a cTrader clean run, without any action taken by the user. No cBots runniung, etc.
It is shown that, after cTrader is lauched, the RAM usage is about 350MB, while after 50 hours 1GB is being used. Memory usage has tripled in only 50 hours without any activity!!
As you might understand, it is impossible to handle such a situation for much longer, even with very kind hardware resources.
- What's the reason for this?
- Is there any solution for this?
Thanks for assisting.
cTrader version tested: 4.6.2
Replies
ncel01
01 Feb 2023, 11:55
RE:
Spotware said:
Dear trader,
Unfortunately we cannot know what is the exact cause of this behavior on your system. Our team is working on improving memory management for future releases of cTrader.
Best regards,
cTrader Team
Hi team,
Many thanks for the feedback!
I believe this behaviour is not limited to my system but a general issue with cTrader since this is happening in both my laptop and the VPS.
It's really good to know that you're working on this!
Regards.
Tip: I've noticed that memory usage is somehow correlated with the market behaviour, as an increase in RAM usage is more evident in the busiest hours (market opening/closing times).
@ncel01
PanagiotisChar
01 Feb 2023, 12:40
Hi ncel01,
What you describe is a somewhat expected behavior. More activity on the market, more incoming ticks, more bars on the chart, more memory used. Sometimes resources is the price to pay for advanced features and modern technology. Nevertheless there is always some room for improvements. I am sure this will become better and better with every update of cTrader.
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar
ncel01
01 Feb 2023, 14:10
RE:
PanagiotisChar said:
Hi ncel01,
What you describe is a somewhat expected behavior. More activity on the market, more incoming ticks, more bars on the chart, more memory used. Sometimes resources is the price to pay for advanced features and modern technology. Nevertheless there is always some room for improvements. I am sure this will become better and better with every update of cTrader.
Need help? Join us on Telegram
Need premium support? Trade with us
Hi Panagiotis,
Thanks for your feedback.
In one hand I understand the behaviour. On the other hand, I don't see that memory is released in the same proportion when market gets more inactive. As result, memory usage increases over time.
The main issue is not the high memory usage itself but the fact that there is clearly a cumulative trend.
Unfortunately, there is no option to disable features that can mainly contribute for a high memory usage.
For instance, if I only want to run cBots there is no need to have memory resources used on some other features like charts, etc.
It would be nice to have dynamic settings (that can be saved/exported) available in the future, so that you can reduce/optimize the hardware usage by only selecting the features you really need for the purpose. This gets even more relevant when considering a multi-instance app like cTrader.
Additionally, or alternatively, an option to disable any of the main tabs (Trading, Copy, Automate, Analyze) would be also great.
I am aware that asking for improvements is much easier than implementing these, however, suggestions are never too many, I believe.
I obviously do not think that the app is bad. In fact the app is great and I am posting because I also believe it will get better and better. However, I hope that priority will be given to the memory management in the future.
Regards.
@ncel01
PanagiotisChar
02 Feb 2023, 08:20
Hi ncel01,
Did you try Force GC? What happens? Sometimes it justs takes time for .Net to release unused resources.
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar
ncel01
02 Feb 2023, 13:59
RE:
PanagiotisChar said:
Hi ncel01,
Did you try Force GC? What happens? Sometimes it justs takes time for .Net to release unused resources.
Hi Panagiotis,
No, I didn't.
I've read about it but I didn't try it yet as I am not sure when to call it nor I am sure what conditionals to use.
I am also not sure if this will work since all the memory is being used by the main process and not by the algohost process.
Any tips?
Thank you!
@ncel01
PanagiotisChar
02 Feb 2023, 14:17
Hi ncel01,
I mean this one
If no memory is released when you click on it, then it's a cTrader issue. Else it's just the GC being lazy.
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar
ncel01
03 Feb 2023, 14:14
( Updated at: 21 Dec 2023, 09:23 )
RE:
PanagiotisChar said:
Hi ncel01,
I mean this one
If no memory is released when you click on it, then it's a cTrader issue. Else it's just the GC being lazy.
Hi Panagiotis,
Sorry, I thought you meant implementing GC.Collect() in cBot code.
I tried the above but I did't see any clear improvement.
However, I don'd think this proves that there is no issue with cTrader when it comes to memory management. In the limit, only what is referenced to be collected will be collected, right?
I also don't think that acting "lazy" is a very technical behaviour for a .NET native method.
@ncel01
ncel01
31 Jan 2023, 10:35 ( Updated at: 21 Dec 2023, 09:23 )
RE: cTrader memory leaks (clean run)
ncel01 said:
Hello,
Is there any update on this?
Thanks.
@ncel01