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

Possible memory leak in Xamarin.Forms?

$
0
0

I've just started using the Xamarin Profiler, and I've noticed this:

  • If you create a new Solution using the Xamarin.Forms Master Detail template
  • Run the profiler on it.
  • Take a snapshot.
  • Tap on the "Add" button (it opens the NewItemPage Page), cancel, tap on add again.. repeat as many times as you want.
  • Take another snapshot.

If you check the profiler, there are as many "live" instances of NewItemPage in memory, as times you've clicked in Add, all of them marked as "live".

Am I misunderstanding how the profiler works, or does this means that there is a memory leak in the app?


Just some extra info:

I've just started using the Xamarin Profiler to review one of our apps and make sure that there were no memory leaks in it and, after much trial and error, I've found that Xamarin pages stay in memory as soon as I add a ToolbarItem in ContentPage.ToolbarItems. Like no code or whatever, just add it and the page stays in memory according to the profiler. Remove it and the profiler shows that the page is collected as soon as it is closed.

I wanted to reproduce this using an empty app (using just one of the default templates) but in this case the page is not collected even if I replace the toolbar with a couple of buttons in the stacklayout.

I'm using Visual Studio 8.0.4 and Xamarin Forms 3.6.0.264807, btw, testing on an Android 8.0 emulated device.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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