内存不足.NETCF Windows Mobile 5 [英] Out of memory .NETCF Windows Mobile 5

查看:96
本文介绍了内存不足.NETCF Windows Mobile 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个用C#编写的.NETCF 3.5应用程序,其中我们使用一些相当大的对象列表和字典,其中填充了来自SQL Server的数据,并持久存储在设备上的SQLCE数据库中.

We have a .NETCF 3.5 app written in C# where we use some fairly large lists and dictionaries of objects, populated with data from a SQL Server and persisted to SQLCE databases on the device.

直到最近,该应用程序都运行良好.数据量如此之大,以至于我们经常会出现内存不足异常.通过使用Hibernate事件,我已经确认操作系统确实在要求应用程序释放资源(Hibernate事件不断触发).麻烦之处在于,我确实看不到任何可以释放的实质内容-列表和字典等都被应用程序使用.

The app was running very well until recently. The amount of data is such that we are getting Out of memory exceptions quite frequently. Using the Hibernate event, I have confirmed that the OS is indeed asking the app to free up resources (the Hibernate event gets fired constantly). The rub is that I really do not see anything substantial that I can free up - the lists and dictionaries, etc. are all being used by the application.

我知道Mobile 5/6中的应用程序有32 MB的硬限制(实际上,根据

I know there is a hard 32 MB / app limit in Mobile 5/6 (in reality only 18-20 MB, per http://dev.fittingsites.com/bol/2008/windows-mobile-6-1-memory-management-changes).

我在这里有点茫然.如果该应用程序需要大约25 MB的操作量,如何在Mobile 5上运行?是否有解决方法,例如将列表或字典存储在内存映射文件"中或类似的方法不需要大量工作(或使工作变慢了很多)?

I am a bit at a loss here. If the app needs about 25 MB to operate, how can it run on Mobile 5? Are there workarounds, like storing lists or dictionaries in Memory Mapped Files or similar that would not require a ton of work (or slow things down much)?

推荐答案

您使用哪种方法从SQLCE数据库中读取数据? SQLCE提供了两种主要方法:数据集结果集.众所周知,数据集会消耗大量内存并降低应用程序性能.如果您使用的是DataSet,我建议尝试将您的应用程序切换为使用RecordSet.有关更多详细信息,请参见此页面.

Which method are you using to read data from your SQLCE database? SQLCE provides two main approaches: DataSets and ResultSets. DataSets are known to consume huge amounts of memory and to reduce the application performance. If you are using DataSets I would recommend trying to switch your application to use RecordSets instead. See this page for more details.

这篇关于内存不足.NETCF Windows Mobile 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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