react-native-fast-image icon indicating copy to clipboard operation
react-native-fast-image copied to clipboard

iOS memory leaks when render WebP images

Open Stafox opened this issue 4 years ago • 13 comments

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

Stafox avatar Oct 24 '20 22:10 Stafox

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?

MiguelGrability avatar Dec 07 '20 17:12 MiguelGrability

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

Stafox avatar Dec 07 '20 19:12 Stafox

有解决办法吗?同求 Is there a solution? Seeking the same

lhb11 avatar Dec 21 '20 03:12 lhb11

有解决办法吗?同求 Is there a solution? Seeking the same

No yet. I think you can put +1 here

Stafox avatar Dec 21 '20 18:12 Stafox

How are you guys even getting WebP to work? I'm on 8.3.4 and I can't even load WebP images.

mikecfisher avatar Feb 16 '21 21:02 mikecfisher

I used to use FastImage to support webp. But it takes up too much memory. How to solve it

baronha avatar Jun 25 '21 10:06 baronha

FastImage memory leak issue when loading webp images, any fixes or alternative for this?

amalmohann avatar Oct 19 '22 10:10 amalmohann

@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 avatar Oct 20 '22 06:10 Stafox

@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.

amalmohann avatar Oct 20 '22 10:10 amalmohann

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.

Stafox avatar Oct 20 '22 17:10 Stafox

I have a similar problem with Flatlist and infinite scroll, the ram increase while scrolling, and then the app crashed.

alexrequelme avatar Jan 30 '23 15:01 alexrequelme

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

invyctus92 avatar Apr 07 '23 13:04 invyctus92

I have the same problem, the FFFastImageView is not being released, does anyone know how to fix it?

rabbitmouse avatar Jan 05 '24 02:01 rabbitmouse