Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UWP App: Process Memory Usage vs Heap Usage

I'm trying to profile my UWP (Universal Windows Platform) app in Visual Studio to see what is causing my Process Memory Usage to be so high.

I've been using Visual Studio's built in Diagnostic Tools and I haven't had any luck. It's been showing my Process Memory Usage at 93 megabytes while the Heap shows 12.17 MB and the Managed Heap shows 1.56 MB.

enter image description here

There was just another instance where my Process Memory Usage ran up to about 458 MB and kept climbing, but when I took a snapshot, it didn't tell me the values of any of the objects that should of been causing it, and the actual memory it claimed to be using was so much less than the Process Memory.

enter image description here

I'm not sure if I just don't understand how the profiler works, or I'm just doing something completely wrong entirely.

like image 826
Destiny Faith Avatar asked Sep 26 '22 05:09

Destiny Faith


1 Answers

The simple answer is - even though your app is written in C# - it still allocates large amounts of native memory.

Typically bitmaps you load in an app use most memory, so I would start looking into reducing the number and resolution of bitmaps you have in your memory and making sure they don't leak.

Second - make sure your lists are virtualized. If you load 1000 images in memory - even if they are small they will still use a lot of memory. By default - list controls like ListBox, ListView or GridView are virtualized, unless you put them in a ScrollViewer or change the default ItemsPanel to one that isn't virtualized.

like image 125
Filip Skakun Avatar answered Sep 29 '22 02:09

Filip Skakun