react-native-fast-image
react-native-fast-image copied to clipboard
iOS memory leaks when render WebP images
Describe the bug I use the library to render WebP images inside FlatList. Number of images about 100. Have see memory leaks like described here #622 and here #560
Looks like issue connected with [SDWebImage/SDWebImageWebPCoder] (discussion here)(https://github.com/SDWebImage/SDWebImageWebPCoder).
To Reproduce Render WebP images inside your application.
Expected behavior No memory leaks while WebP images are rendering.
Dependency versions
- React Native version: 0.63.3
- React version: 16.14.0
- React Native Fast Image version: 8.3.2
Hi, We've been dealing with a memory leaks reports from sentry related with SDWebImage
and SDWebImageDownloaderOperation
Have you considered to upgrade SDWebImage
and SDWebImageWebPCoder
to the latest version?
Of course, I've created an issue here to update dependencies in the future.
There is an issue https://github.com/SDWebImage/SDWebImageWebPCoder/issues/46
有解决办法吗?同求 Is there a solution? Seeking the same
How are you guys even getting WebP to work? I'm on 8.3.4 and I can't even load WebP images.
I used to use FastImage to support webp. But it takes up too much memory. How to solve it
FastImage memory leak issue when loading webp images, any fixes or alternative for this?
@amalmohann any evidence? Profiler results? As for me there is no issue starting iOS 14 because it uses native webp codec. So I just up required minimal iOS version to 14.0
@Stafox i was testing this in iPhone 12. my phone got heated up and after a while it closed with memory exception. Once removed the package everything went back to normal and haven't had any issue since. But now the image loading is very slow.
maybe problem with you unoptimized flatlist or whatever you use. So, debug it and share iOS profiler results to see what exactly leaks. Information about number of images on screen also can be helpful. Otherwise do not expect that it can be fixed without steps of reproduce.
I have a similar problem with Flatlist and infinite scroll, the ram increase while scrolling, and then the app crashed.
Maybe I solved it by updating the graphics library used on iOS, just update the following file found in the react-native-fast-image library with the new versions, and run the pod update command on the iOS folder file RNFastImage.podspec
require 'json'
Pod::Spec.new do |s|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
s.name = "RNFastImage"
s.version = package['version']
s.summary = package['description']
s.authors = { "Dylan Vann" => "[email protected]" }
s.homepage = "https://github.com/DylanVann/react-native-fast-image#readme"
s.license = "MIT"
s.platforms = { :ios => "8.0", :tvos => "9.0" }
s.framework = 'UIKit'
s.requires_arc = true
s.source = { :git => "https://github.com/DylanVann/react-native-fast-image.git", :tag => "v#{s.version}" }
s.source_files = "ios/**/*.{h,m}"
s.dependency 'React-Core'
s.dependency 'SDWebImage', '~> 5.15.5'
s.dependency 'SDWebImageWebPCoder', '~> 0.11.0'
end
I have the same problem, the FFFastImageView is not being released, does anyone know how to fix it?