Q:

Xamarin Forms Microcharts generating "OutOfMemoryError"

I am trying to use a Microcharts graph in my application, which is using Xamarin.Forms (targeting Android, iOS and UWP).
I have tried following several tutorials to get a chart to display but each time it results in the error:  

Unhandled Exception:
  Java.Lang.OutOfMemoryError: Failed to allocate a 240048012 byte allocation with 5713730 free bytes and 87MB until OOM

If I make a new Xamarin.Forms project, this error doesn't occur and it runs absolutely fine (I am running on the same Android device, a Samsung SM-J320FN).
Here is the simplified XAML code:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Foo.DetailPage" xmlns:forms="clr-namespace:Microcharts.Forms;assembly=Microcharts.Forms">
<ContentPage.Content>
<StackLayout Grid.Row="2">
     <forms:ChartView x:Name="priceChart" HeightRequest="150"/>
 </StackLayout>
Here is the Code Behind:
//Temp data for charts
 List<Entry> entries = new List<Entry>
 {
     new Entry(200)
     {
         Color=SKColor.Parse("#FF1943"),
         Label ="January",
         ValueLabel = "200"
     },
     new Entry(400)
     {
         Color = SKColor.Parse("00BFFF"),
         Label = "March",
         ValueLabel = "400"
     },
     new Entry(-100)
     {
         Color =  SKColor.Parse("#00CED1"),
         Label = "Octobar",
         ValueLabel = "-100"
     },
 };
public DetailPage(string Code)
{
     ((NavigationPage)Application.Current.MainPage).BarBackgroundColor = Color.FromHex("27b286");

    InitializeComponent();

    priceChart.Chart = new LineChart() { Entries = entries, BackgroundColor = SKColor.Parse("#00FFFFFF") };
}

Without this chart, the page can run absolutely fine, even when the list is generated and the chart is included in XAML, it seems to be when initialising the chart through the code behind that causes the issue.

A:

I added <application android:hardwareAccelerated="true" android:largeHeap="true"></application> to my AndroidManifest.xml and this works fine, however I still don't know what was causing so much memory to be used.

