本文参考自:http://www.cnblogs.com/hebeiDGL/p/3410188.html
static System.Windows.Threading.DispatcherTimer dispacherTimer;static string total = "DeviceTotalMemory";static string current = "ApplicationCurrentMemoryUsage";static string peak = "ApplicationPeakMemoryUsage";static long totlaBytes;static long currentBytes;static long peakBytes;public MainPage(){InitializeComponent();checkmemory();}void checkmemory() {dispacherTimer = new System.Windows.Threading.DispatcherTimer();dispacherTimer.Interval = TimeSpan.FromSeconds(2);dispacherTimer.Tick += dispacherTimer_Tick;dispacherTimer.Start();}void dispacherTimer_Tick(object sender, EventArgs e){// 获取设备的总内存totlaBytes = (long)Microsoft.Phone.Info.DeviceExtendedProperties.GetValue(total);// 获取应用当前占用内存currentBytes = (long)Microsoft.Phone.Info.DeviceExtendedProperties.GetValue(current);// 获取内存占用的峰值peakBytes = (long)Microsoft.Phone.Info.DeviceExtendedProperties.GetValue(peak);txtMemory.Text = string.Format("当前:{0:F2}MB; 峰值:{1:F2}MB; 总:{2:F2}MB;", currentBytes / (1024 * 1024.0), peakBytes / (1024 * 1024.0), totlaBytes / (1024 * 1024.0));}