From the course: New Features Xamarin and Visual Studio 2017

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

How Xamarin handles memory in Android

How Xamarin handles memory in Android

From the course: New Features Xamarin and Visual Studio 2017

Start my 1-month free trial

How Xamarin handles memory in Android

- [Instructor] Xamarin Android and Xamarin iOS handle memory in very different ways. To fully understand why a memory leak, or a crash, happens in a Xamarin Android application, we need to understand how the mono memory management system interacts with the underlying Java Platform. In Xamarin iOS, there is the mono garbage collector working with the underlying iOS objects that use reference coding. In Native Android, however, it sits on top of Java, which has its own garbage collector. This means that as Xamarin Android application actually has two garbage collectors. One is the .NET Garbage Collector that is part of the mono framework. The other's the native Java Garbage Collector. Like the .NET objects under the garbage collector, Java objects are not released until the Java garbage collector unloads them, which will happen when it detects sufficient memory pressure. The problem with this, is the mono garbage collector understands what's happening with the .NET objects, and the Java…

Contents