简体   繁体   English

加载图像时出现WP8 Out of Memory错误

[英]WP8 Out of Memory error while loading Images

I am working on Windows Phone 8 app. 我正在使用Windows Phone 8应用程序。

I am working on Coverflow feature, i am trying to load 600 items but it always shows Out of Memory Error 我正在研究Coverflow功能,我正在尝试加载600项但它总是显示Out of Memory Error

Code: 码:

<DataTemplate x:Key="DataTemplate1">
            <Grid VerticalAlignment="Center" HorizontalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Border Grid.Row="0" Height="400" Width="400" CornerRadius="30,30,30,30">
                    <Border.Background>
                        <ImageBrush ImageSource="Images/sample.png" />
                    </Border.Background>
                </Border>
                <Grid Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Top">
                    <TextBlock HorizontalAlignment="Center" 
                               VerticalAlignment="Center"
                               Margin="5,20,5,5"
                               Foreground="#000000"
                               Text="{Binding Title}"/>
                </Grid>
                <Grid Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Bottom">
                <TextBlock HorizontalAlignment="Center" 
                               VerticalAlignment="Center"
                               Margin="5,5,5,20"
                               Foreground="#000000"
                               Text="{Binding SubTitle}"/>
                </Grid>
            </Grid>
        </DataTemplate>

I have tried checking why its happening so,because each time it loads image with the below code 我已经尝试检查它发生的原因,因为每次使用下面的代码加载图像

<Border Grid.Row="0" Height="400" Width="400" CornerRadius="30,30,30,30">
                        <Border.Background>
                            <ImageBrush ImageSource="Images/sample.png" />
                        </Border.Background>
                    </Border>

I tried removing Width and Height and it works but i want the image to bigger. 我尝试删除WidthHeight ,它的工作原理,但我希望图像更大。

How can i fix this ? 我怎样才能解决这个问题 ?

Here it's been discussed in detail. 这里已经详细讨论过了。 What you'll need to do is use Memory Profiling and periodically check which the memory Heap to see what's allocated when it shouldn't be. 您需要做的是使用内存分析并定期检查内存堆,以查看不应该分配的内容。

How to debug running out of memory on Windows Phone 如何调试Windows Phone上的内存不足

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM