Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Memory management

$
0
0

I have been profiling my app(on iOS at this stage) and would like to reduce the impact that images(among other things) have on it. I'm loading the images with a UriImageSource with cache enabled.

If a push a page which has an image on it the heap grows by 4 meg. If I then pop the page the heap doesn't shrink at all. Pushing the same page makes the heap grow again. Repeating this process seems to continually grow the heap with no sign of it ever reducing.

Is this expected behaviour? I thought that the pages should release all memory associated with them when they are popped.

I then tried to override the OnDisappearing and setting the images to null but this causes an exception when the load image callback returns....gah. I also tried to override the ImageRenderer set image property to check for nulls but couldn't do that.

Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException)
  at Xamarin.Forms.Platform.iOS.ImageRenderer+<SetImage>d__0.MoveNext () [0x00000] in <filename unknown>:0 

Viewing all articles
Browse latest Browse all 58056

Trending Articles