Unsubscribe from events - Any benefits ?
Created at 28 Feb 2023, 11:28
Unsubscribe from events - Any benefits ?
28 Feb 2023, 11:28
Hello,
I wonder if unsubscribing from events can have an impact in performance (e.g.: reduce RAM usage).
It is not that easy to manage cAlgo methods when you don't really know how these manage memory resources.
Is there any documentation about this?
Thank you.
firemyst
01 Jun 2023, 06:00
This is more a C# thing than a cTrader thing.
If you unsubscribe from events, it could free up some resources and make available for garbage collection.
Do a little Google research.
https://stackoverflow.com/questions/506092/is-it-necessary-to-explicitly-remove-event-handlers-in-c-sharp#:~:text=Yes%2C%20you%20will%20want%20to,reference%20remains%2C%20it%20is%20live.
@firemyst