Question: I have a fairly simple question that I can't answer my self.. Also Google and StackOverflow provided no results :(.

I want my DecodePixelHeight of my BitmapImage to be depended on the amount of RAM the device has. If the device has 512 MB then the DecodePixelHeight should be lower than 1GB and 2GB. I do this because I'm struggling with memory issues.

How do I recognize a low-end device with 512 MB on Windows Phone 8.1 (Universal App)?

Kind regards,
Niels

Answer: 
MS doesn't provide exact method to find the amount of device RAM, but I found the solution myself. I'm telling you what I did to write app code according to device RAM. 

```
private void deviceMemory()
    {
        var memoryLimit = Windows.System.MemoryManager.AppMemoryUsageLimit;
        memoryLimit = (memoryLimit / 1024) / 1024;
        Debug.WriteLine("Device Memory Limit: "+memoryLimit+"MB");
    }

```

It is not what you were expecting but it's always better to have something than nothing. After finding device memory limit I can easily write app code accordingly.

![Memory caps table](https://i.stack.imgur.com/cIMiD.jpg)
Take a look at this article on MSDN

[Developing apps for lower-memory phones for Windows Phone 8](http://msdn.microsoft.com/en-us/library/windows/apps/hh855081(v=vs.105).aspx)

One of the topics is relating to Application Memory limits (allocated by the OS). I think that is the value you should be more worried about, not necessarily the physical memory of the device.

> 
> **Checking the app memory limits of the device**
> 
> 
> With Windows Phone SDK 8.0 or Windows Phone SDK 7.1.1 Update, you can
>  check the memory working set limit of the device hosting your app and
>  Then you can disable some features of your app if you know they aren’t
>  supported or are memory-intensive. To check the memory working set
>  limit, you call the GetValue(String) methodand pass
>  ApplicationWorkingSetLimit for the propertyName parameter. The
>  following code shows how to do this. C#
> 
> 
> 

```
// Place call in a try block in case the user 
// is not running a version of the Windows Phone OS 
// that supports this method call.
try
{
  long result =  
    (long)DeviceExtendedProperties.GetValue("ApplicationWorkingSetLimit");
}
catch (ArgumentOutOfRangeException)
{
  // The device does not support querying for this value. This occurs
  // on Windows Phone OS 7.1 and older phones without OS updates.
}

```

There is a table that shows you how the memory limits should relate to the physical memory of the device.

Also, take a look at this article: [App memory limits for Windows Phone 8](http://msdn.microsoft.com/en-us/library/windows/apps/jj681682%28v=vs.105%29.aspx)