Hello Xamarin,
After profiling our app we found some issues which causes memory leaks in our app.
Maybe it is by design, maybe not, but this is what we found.
In our app we have a single CarouselPage which we reuse every time.
This because we otherwise leaked a lot more.
Ps. Going to look into this now why in first case we leak. But still wondering about what we found so far.
What we found is that when we keep the CarouselPage alive, we still leak.
It looks like some of the renderers stay alive when navigating.
Par example we found the following issues:
a) The CarouselPageRenderer contains these two line in the ViewDidLoad();
this.Carousel.add_PropertyChanged(new PropertyChangedEventHandler(this.OnPropertyChanged));
this.Carousel.add_PagesChanged(new NotifyCollectionChangedEventHandler(this.OnPagesChanged));
It looks like the remove from the OnPagesChanges is missing in the Dispose.
b) The ViewRenderer<TView, TNativeView> contains the next line in OnElementChanged
e.NewElement.add_FocusChangeRequested(new EventHandler<VisualElement.FocusRequestArgs>(this.ViewOnFocusChangeRequested));
For the old value it's getting removed in the OnElementChanged, but in the dispose it isn't.
Not yet looked any further, but is it by design not to reuse the same pages over and over again?
Or are these simple small issues which can be fixed from your side?
Currently we use the Xamarin.Forms.2.0.1.6492-pre1 version and only looked into the IOS version so far.
Best Regards,
Daniel de Vries