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

ListView using FrameRenderer Out Of Memory Android

$
0
0

I've got a very basic application that is populating a ListView with about 100 items using the following data template:

    <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                        <Frame Padding="10">
                            <StackLayout BackgroundColor="#BDBFC4" Padding="1" Spacing="0">
                                <Grid BackgroundColor="White" MinimumHeightRequest="30" Padding="6"
                                      VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <BoxView Color="Gray" HorizontalOptions="FillAndExpand" />
                                    <Image Source="{Binding PrimaryImage}" />
                                </Grid>
                                <BoxView Color="#BEC1C5" HeightRequest="1" VerticalOptions="Center"
                                         HorizontalOptions="Fill" />
                                <Grid BackgroundColor="#FAFAFA" Padding="6">
                                    <Label Text="{Binding Post.Title}" />
                                </Grid>
                            </StackLayout>
                        </Frame>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>

My Image Source actually only provides an image for the first 2 elements and all the rest are null, so I don't think my Out of Memory exception has anything to do with the downloading of images.

    Out of memory on a 610576-byte allocation.
     "main" prio=5 tid=1 RUNNABLE
       | group="main" sCount=0 dsCount=0 obj=0x40f096d0 self=0x4003c018
       | sysTid=21067 nice=0 sched=0/0 cgrp=apps handle=1074923568
       | schedstat=( 0 0 0 ) utm=1450 stm=197 core=0
       at android.graphics.Bitmap.nativeCreate(Native Method)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:950)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:925)
       at xamarin.forms.platform.android.FrameRenderer_FrameDrawable.n_draw(Native Method)
       at xamarin.forms.platform.android.FrameRenderer_FrameDrawable.draw(FrameRenderer_FrameDrawable.java:49)
       at android.view.View.draw(View.java:13521)
       at android.view.View.getDisplayList(View.java:12487)
       at android.view.View.getDisplayList(View.java:12531)
       at android.view.View.draw(View.java:13260)
       at android.view.ViewGroup.drawChild(ViewGroup.java:2947)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2817)

I simply scroll down the list and while it varies slightly at the time it crashes the stack trace is consistent. It doesn't crash until I begin scrolling.

Any ideas?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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