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

SDWebImage uses more memory when image is loaded for the first time #1354

Closed
ejoebstl opened this issue Oct 29, 2015 · 9 comments
Closed

SDWebImage uses more memory when image is loaded for the first time #1354

ejoebstl opened this issue Oct 29, 2015 · 9 comments
Milestone

Comments

@ejoebstl
Copy link

While working with SDWebImage, we observed that the initial download of an image takes more memory than loading the image from the disk cache.

screenshot 2015-10-29 14 36 34

The memory consumption can be seen in the above screenshot. The call was identical both times, the image was downloaded from the internet the first time, and then loaded from disk the second time.

In this case, the issue increased the memory consumption by about 50 MB.

How could we work around this additional memory consumption?

@mythodeia
Copy link
Contributor

is the image large in resolution or size?

@ejoebstl
Copy link
Author

Exactly. 4096 * 4096 pixels, jpeg.

@mythodeia
Copy link
Contributor

That's a logical memory spike then.
On Πέμ, 29 Οκτ 2015 at 17:11, Emanuel Jöbstl notifications@github.com
wrote:

Exactly. 4096 * 4096 pixels, jpeg.


Reply to this email directly or view it on GitHub
#1354 (comment).

@mythodeia
Copy link
Contributor

Just a reference for the image used:
Its size is 4096 width x 4096 height.
So for every pixel in an image 4 bytes are used. To calculate the memory:
height x width x 4 = total bytes in memory.
4096 * 4096 * 4 = roughly 64MB

@ejoebstl
Copy link
Author

That's true, but what's the reason for the spike to not occur when the image is loaded from the disk?

@ejoebstl
Copy link
Author

bump
Is there anything I could do to help with this issue?

@bpoplauschi bpoplauschi added this to the 4.0.0 milestone May 29, 2016
@bpoplauschi
Copy link
Member

Not sure how to proceed here. Large images will do spikes, no matter what we do

@bpoplauschi bpoplauschi modified the milestones: Future, 4.0.0 Oct 1, 2016
@ejoebstl
Copy link
Author

ejoebstl commented Oct 1, 2016

I agree, It's not logical. It's larger than it should be. It also happens for small images (the spike is just smaller).

@bpoplauschi
Copy link
Member

I think this issue is similar to #538 and #586.
#787 and 00bf467 should give you a good solution for dealing with large images. Together with the GIF handled by FLAnimatedImage, this ticket should be done now.

Closing. Let's see how this is with 4.0.0

@bpoplauschi bpoplauschi modified the milestones: 4.0.0, Future Oct 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants