Closed lisindima closed 3 years ago
Memory spikes happen naturally because images are big, this is not necessarily a bug. However, version 2 is missing control over maximum size of a decoded image. Adding this will help reduce memory consumption. I'm working on it.
And thank you for detailed report 👍
Hey,
there's a new version 2.1.4. You can now specify maximum image dimensions in pixels using maxPixelSize
property of URLImageOptions
. It defaults to 300x300. I picked this number randomly, maybe will change it or introduce some logic based on the device type in the future.
Using maxPixelSize
eliminates memory spikes in my tests. I'm closing the issue, but feel free to reopen if you discover an edge case.
Summary and/or background The moment I open my list with a large number of images, there is a huge peak in memory consumption. Sometimes this does not happen in the same situation, I could not understand this pattern. I also notice this problem in your demo application for this package. When I choose the option with the largest images.
OS and what device you are using
Version of URLImage library
What you expected would happen Don't have such terrible memory consumption
What actually happens Peak memory consumption, which causes a crash on a real device due to insufficient memory.
Sample code
Test data This is reproduced with any images with a resolution greater than 1000x1000 and a weight greater than 1MB.
Additional information: