App Performance
Optimize memory usage in Xamarin apps
This post has been translated to Russian by Denis Gordin . You can read the Russian version on the Russian website TechMedia . Thanks, Denis! Xamarin is amazing in how it allows .NET developers to write apps for Android, iOS, MacOS… in C#. But that amazing capability comes with a prize and even the most simple apps can suffer from high memory usage. Let’s find out what happens and what we can do about it. The majority of my examples are based on Xamarin.Android, but you’ll quickly notice how this also applies to Xamarin.iOS.
Diagnosing memory issues with the Xamarin profiler
The Xamarin profiler is a must-have tool for every Xamarin developer. The profiler comes with a Xamarin business or enterprise license and is available as a standalone installer at xamarin.com/profiler . To get started, make sure a debug version of your app is installed on a device or a simulator (works both for Android and iOS). Another way to start the profiler is to open the profiler via Run > Start Profiling in Xamarin Studio or Analyze > Xamarin Profiler in Visual Studio. Choose the Memory profiling template, make sure the correct app/activity is selected and press the red record button to start profiling.