Floating FB popout byF5debug

101 How to on Windows Phone – How to #65 – How to get Memory Information of Windows Phone Device


In this article we are going to see how to get Memory Information of the device in a Windows Phone application development programmatically. Devices Memory information can be retrieved by DeviceStatus Class which get the information about the total memory used, current memory, application memory etc. Let us see the steps on how to achieve this task in our Windows Phone application development. Open Visual Studio 2012 IDE and create a new Windows Phone project with a valid project name as shown in the screen below.     [more]


Clicking on OK will create the project and the solution with the list of default files and folders that are required to run the application. It will take some time to create these files based on your system configuration, so once everything is ready we can see the Visual Studio IDE with the project as shown in the screen below.


Add some controls to trigger the event to collect the device memory information, basically we will add a Button control to trigger the click event and a textblock to display the information about the Memory used as shown in the code below.

XAML Code:


<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="F5debug How to Series" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="Photo Chooser" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Button Content="Get Memory Usage" Height="72" HorizontalAlignment="Left" Margin="9,6,0,0" Name="button1" VerticalAlignment="Top" Width="441" />
            <TextBlock Height="334" HorizontalAlignment="Left" TextWrapping="Wrap" Margin="29,108,0,0" Name="textBlock1" Text="" VerticalAlignment="Top" Width="407" />



In the button click event write the below code which basically used the DeviceStatus class to get each and every property that are required to know the Device memory status as shown in the code below.

C# Code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using F5debugHowto65.Resources;
using Microsoft.Phone.Info;

namespace F5debugHowto65
    public partial class MainPage : PhoneApplicationPage
        // Constructor
        public MainPage()

            // Sample code to localize the ApplicationBar

        private void button1_Click(object sender, RoutedEventArgs e)
            txtOutput.Text = "Device Total Memory = " + DeviceStatus.DeviceTotalMemory.ToString() + "\n\r" + "Device Application Current Memory" +
                DeviceStatus.ApplicationCurrentMemoryUsage.ToString() + "\n\r" + "Device Application Memory Usage Limit" +
                DeviceStatus.ApplicationMemoryUsageLimit.ToString() + "\n\r" + "Device Peak Memory Usage" +



Now we are done with the code, just run the application by pressing F5 directly from the keyboard or we can use the Build and execute the project option from the tool bar to run the application. Once the Build is successful we can see the Windows Phone emulator with the application and the expected outputs as shown in the screen below.


About Author: Karthikeyan Anbarasan, Microsoft MVP (Most Valuable Professional) in ASP.NET/IIS Architecture. He is the Founder and Chief Editor of the www.f5debug.net website and has authored books on Windows Phone and Business Intelligence(SSIS). He is also a Passionate Speaker and a Blogger on Microsoft Technologies.

You can Join Me On: Facebook, Twitter, Google Plus, LinkedIn

Comments (1) -

Parker Gudgell
Parker Gudgell
8/31/2013 5:51:29 AM #

What's up to every one, because I am in fact eager of reading this blog's post to be updatd on <br />regular bsis. It includes good stuff.

Add comment

  Country flag

  • Comment
  • Preview

Recent Posts

Random Posts

Most Viewed

URL Shortner

Create your own short urls!!!

Site Counter

free counters


This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet. I have documented my personal experience on this blog.

Protected by Copyscape Web Plagiarism Finder

Site Meter