Event Handlers Removal

1

In a Xamarin.Android plication application, is it important to remove the Event Handlers when exiting the screen to avoid memory consumption? Would it be a good practice?

For example, in OnCreate() of one of the screens of my app, I have the following statement:

_btnStartExam.Click += ShowStartExamConfirmation;

When exiting the screen, for example in OnDestroy() , is it recommended that you do the following?

_btnStartExam.Click -= ShowStartExamConfirmation;

I have read in some posts in the American OS that even though Garbage Collector does this type of work, it is recommended to avoid cyclical references and memory consumption.

However, I would still like more information on this and if it is good for the application lifecycle to make use of this type of technique.

Note that the application stays open all day on the device and the user has no option to sign out for other applications.

    
asked by anonymous 25.07.2018 / 14:00

0 answers