Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Reusing a single CarouselPage causes leaking renderers, is this by design?

$
0
0

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


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>