When you run out of 1G heap size, start optimizing resources.
First, check if you are copying image instances by storing the same image in memory several times. To do this, use the ffimageloading library ( https://github.com/luberda-molinet/FFImageLoading ) to get it quickly and easily.
Then optimize the images you use. For large images other than thumbnails, try converting everything to JPEG format, avoiding png with the transparency that once saved me for constant numbers.
Then try using thumbnails instead of images if you can have large downloaded images on your remote. On your server, pre-create thumbnails for different sizes, mini, small, medium, normal, large, large, etc., and upload only those images that you really need. It saves a lot of memory and speed.
Another is memory leaks. You may have cells or other elements that are still in memory if they are not unsubscribed from messages, event handlers, and some others. Imagine that you may have several copies of a list full of images still in memory when you are sure that this will not happen. More info here:
https://forums.xamarin.com/discussion/123876/should-we-unsubscribe-all-events-for-memory-management
https://forums.xamarin.com/discussion/87206/messaging-center-unsubscribe-from-all-messages-when-broadcast-stops
Nick Kovalsky May 27 '18 at 8:47 a.m. 2018-05-27 08:47
source share