加载图像时WP8内存不足错误 [英] WP8 Out of Memory error while loading Images

查看:91
本文介绍了加载图像时WP8内存不足错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows Phone 8应用.

I am working on Windows Phone 8 app.

我正在使用Coverflow功能,我正在尝试加载600个项目,但它始终显示Out of Memory Error

I am working on Coverflow feature, i am trying to load 600 items but it always shows Out of Memory Error

代码:

<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>

我尝试删除WidthHeight,它可以工作,但我希望图像更大.

I tried removing Width and Height and it works but i want the image to bigger.

我该如何解决?

推荐答案

在此已进行了详细讨论.您需要做的是使用内存分析",并定期检查哪个内存堆,以查看不应该分配的内容.

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.

如何在Windows上调试内存不足的情况电话

这篇关于加载图像时WP8内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆