您的位置:首页 > 其它

Windows Mobile 如何处理低内存情况!

2010-01-25 10:52 204 查看

最近一直在从事Windows Mobile Shell的工作,其中就会考虑在低内存下运行的情况,在wmshellwindowsmobile Blog 里都发现了这篇文章 《 HOW THE WINDOWS MOBILE 5.0 SHELL HANDLES LOW MEMORY SITUATIONS 》,提供了很好的系统级处理方式。



文章对在Hibernate, Kernel-Check, Critical, Execute, Kernel-Critical下的各种模式做了阐述,并提供了一小端代码,可以参考,如下。详细参见原文。

#define MIN_MEMORY_TO_RUN 2*1024*1024

MEMORYSTATUS mst;

mst.dwLength= sizeof(MEMORYSTATUS);

GlobalMemoryStatus(&mst);

If (mst.dwAvailPhys < MIN_MEMORY_TO_RUN)

{

// Try to free memory by asking Shell to shutdown apps

if (!SHCloseApps(MIN_MEMORY_TO_RUN))

{

// Handle the case where memory could not be freed

...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: