Xamarin Android Nursery Size

  android, xamarin, xamarin.android, xamarin.forms

I’m trying to improve the startup time for a Xamarin Android app that contains some Xamarin Forms and some Xamarin Android code. Without making code changes I’ve been looking at what config changes might make a difference. The most significant change was creating a custom trace profile Marco Troncone’s post (which works great but adds a third to the size of the package). I used adb logcat to capture the logs from an Android device and found a lot of instances of Explicit concurrent copying GC. I found I could reduce the number of garbage collections by increasing the nursery size. This is done by adding env.conf to the project with build action AndroidEnvironment and contents:


This documentation indicates the default nursery size is 4MB and by increasing this to 128MB, the number of concurrent garbage collections during startup dropped from 11+ to 2.

What I haven’t been able to find are the other implications of making this change in terms of application performance and resource use, and a lot of the search results are from years ago. Is it ok to set the nursery size to 128MB? Will it cause issues with older devices?

Source: Android Questions