1

I have made a Windows Phone App and am facing memory issues. App closes because of it is using too much memory.

I tried finding ways to figure out, how much memory is being used, which variables are consuming most memory, etc. I did Memory Profiling, and found that when using the app vigorously for 2 minutes it consumes > 150 MB and therefore closes.

However I am not able to know which variable is consuming memory. Or if its images that are consuming memory. I have an appviewmodel variable and my guess is that might be too large but I want to confirm this. How can i find out how much memory this variable is using?

Sagar Sodah
  • 112
  • 1
  • 6

3 Answers3

2

Big memory holes come usually from big files or big loops of small data. With an Garbage Collector, you actually don't get memory holes anymore, but since GCs don't clean variables that are still in use, you still can gain your memory footage easily. This could also happen with cyclic references of multiple objects.

So you should check your code for references of objects that you don't release.

One thing is, that I have in memory that Windows Phone 8 had a bitmap memory leak. So you should clean your images like in this questions. I'm not sure, if this is the thing I remember.

Community
  • 1
  • 1
Hubertus
  • 21
  • 2
1

If you are creating BitmapImage from .cs always decode pixels height/width like this:

BitmapImage bmp= new BitmapImage("ImageUrl");
bmp.DecodePixelHeight = 150;//image control size
bmp.DecodePixelWidth = 150;

It makes a difference!.

vITs
  • 1,651
  • 12
  • 30
0

I think so using large Image may be a one of the and common reason to get memory issues. So it to dispose image. Check this links which may help to you.

  1. Why do I get an OutOfMemoryException when I have images in my ListBox?
  2. System.OutOfMemoryException was unhandled
Community
  • 1
  • 1
Maulik Shah
  • 673
  • 7
  • 19