天天看點

DumpMem and Monster - Virtual Memory Explorers on Windows Mobile/CE

Windows Mobile 5 和 6的平台是建立在CE5.x的基礎上的。當可用的記憶體很少時,平台會自動關閉應用程式。而且,在這個移動平台上,同時隻能運作32個process。在桌面電腦上,我們有4GB的可尋址空間,每個應用程式預設具有2GB的空間。而在Windows Mobile平台上,每個應用程式就隻有32MB的大小。Windows Mobile/CE 實作了系統的虛拟記憶體管理,作業系統使用微處理器的MMU來處理虛拟位址和實體位址間的實時轉換。我們可以使用工具來檢視移動平台上的虛拟位址空間情況。

    這個工具可以在微軟的幫助和支援闆塊裡面下載下傳到。下載下傳後,将檔案解壓,可以看到該工程是使用EVC3來編譯的,由于我的機子上沒有安裝Microsoft eMbedded Visual Tools 3.0,是以,就直接隻用其中已經編譯好的可執行檔案。由于模拟器是基于ARM的,是以可以在ARMRel檔案夾下找到dumpmem.exe這個檔案。如果是基于x86的CE PC,那麼就可以使用X86Rel檔案下的同名檔案。将其拷貝到storage目錄下,在模拟器上運作,效果如下圖1所示:

DumpMem and Monster - Virtual Memory Explorers on Windows Mobile/CE

圖1:dumpmem運作界面

    選擇自己建立的應用程式“SMSNotifer”,點選“Create File”後,會在裝置的根目錄下生成一個dumpmem.txt檔案,如下圖2所示:

DumpMem and Monster - Virtual Memory Explorers on Windows Mobile/CE

圖2:dumpmem.txt所在的目錄

    使用word mobile打開後,可以發現很多資訊,包括目标平台、選擇的應用程式資訊等等,如下圖3所示:

DumpMem and Monster - Virtual Memory Explorers on Windows Mobile/CE

圖3:dumpmem.txt所包含的資訊

DumpMem and Monster - Virtual Memory Explorers on Windows Mobile/CE

圖4:Slot1~3的記憶體占用情況

    這個例子使用C++來寫,并在VS2005環境下編譯的一個工程檔案。有這方面需求的朋友可以關注一下。

參考文章:

<a href="http://support.microsoft.com/default.aspx/kb/326164/">用于 Pocket PC 2002 上檢視虛拟位址空間的 Dumpmem 實用工具</a>

<a href="http://blogs.msdn.com/hegenderfer/archive/2007/08/31/slaying-the-virtual-memory-monster.aspx">Slaying the Virtual Memory Monster - Part I</a>

<a href="http://blogs.msdn.com/hegenderfer/archive/2007/10/01/slaying-the-virtual-memory-monster-part-ii.aspx">Slaying the Virtual Memory Monster - Part II</a>

<a href="http://www.codeproject.com/KB/mobile/VirtualMemory.aspx">Visualizing the Windows Mobile Virtual Memory Monster</a>

本文轉自施炯部落格園部落格,原文連結:http://www.cnblogs.com/dearsj001/archive/2009/01/16/1377107.html,如需轉載請自行聯系原作者