Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading this webp image crashes #114

Open
DevWhan opened this issue Dec 23, 2024 · 5 comments
Open

Loading this webp image crashes #114

DevWhan opened this issue Dec 23, 2024 · 5 comments

Comments

@DevWhan
Copy link

DevWhan commented Dec 23, 2024

unused SDWebImageAWebPCoder
de3bc07f4186db0094ed2187883cd46e.zip

@DevWhan
Copy link
Author

DevWhan commented Dec 24, 2024

In the latest SDWebImage Demo, it can be reproduced. I only used SDImageWebPCoder instead of SDImageAWebPCoder. I called sd_setImageWithURL and passed in the remote address of this image. The memory began to grow infinitely until it was killed.
iPhone11 iOS18.2

@DevWhan
Copy link
Author

DevWhan commented Dec 24, 2024

I tried to use SDWebImageAPWebCoder in our project and it also crashed. Using Demo, I finally found that the memory of this image would soar to 1.6G when loading, and if multiple images were displayed in the UITableViewCell, it would crash. I don't know if it was the problem with the image itself, or if the decoding was just so big. The Demo has been uploaded. If you have time to trouble reading it, thank you very much
SDWebImage-5.20.0 2.zip

@lperezdude
Copy link

@DevWhan I think im running into the same issue. I have a feed paginated of images from a server. However when enough images are loaded they stop loading, app does not crash but i get the following on the warning on the console.
Any idea how to stop this from happening ?

"CGSImageDataLock: Cannot allocate memory
CGBitmapContextInfoCreate: unable to allocate 48771072 bytes for bitmap data
CGBitmapContextInfoCreate: unable to allocate 48771072 bytes for bitmap data
CGDisplayListDrawInContext: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
CGBitmapContextCreateImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
CGBitmapContextInfoCreate: unable to allocate 48771072 bytes for bitmap data
CGBitmapContextInfoCreate: unable to allocate 48771072 bytes for bitmap data
CGDisplayListDrawInContext: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
CGBitmapContextCreateImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable."

@dreampiggy
Copy link
Contributor

dreampiggy commented Jan 17, 2025

OOM ?

Maybe you can use that ScaleDownIimitBytesSize (https://sdwebimage.github.io/documentation/sdwebimage/sdwebimagecontextoption/imagescaledownlimitbytes) option or using ThumbnailPixelSize

This can reduce the RAM usage for loading

@DevWhan
Copy link
Author

DevWhan commented Jan 17, 2025

OOM ?

Maybe you can use that ScaleDownIimitBytesSize (https://sdwebimage.github.io/documentation/sdwebimage/sdwebimagecontextoption/imagescaledownlimitbytes) option or using ThumbnailPixelSize

This can reduce the RAM usage for loading

Yes, I suspect that the OOM was caused by SDImageWebPCoder. The image itself is only 3.4MB
If you have time, you can look at the last demo I sent, and you can reproduce this problem.
ScaleDownIimitBytesSize can really solve my problem, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants