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

Add option to disable in-memory NSCache #1130

Closed

Conversation

mallorypaine
Copy link

No description provided.

@mallorypaine
Copy link
Author

This is a workaround for #538. NSCache truly is the problem and by disabling it, memory spikes are completely eliminated. Some may argue that it's OK for NSCache to balloon since that device memory is "available" to be used by a cache, but as your foreground app consumes memory, it will cause apps in the background to receive warnings and to be exited. I'd rather my app be a good citizen by not ballooning in the first place.

FWIW, setting the max cache cost to zero also doesn't prevent those huge spikes; disabling NSCache is the only way to achieve the memory behavior that my app needs.

@bpoplauschi bpoplauschi added this to the 4.0.0 milestone Apr 27, 2015
@rromanchuk
Copy link
Contributor

@mallorypaine thanks for jumping over to this project and for this PR 👍 This has been plaguing this project for a long time now.

@KiranPanesar
Copy link

I implemented this in my local branch just to test and it didn't fix the VM: CG raster data memory ballooning. Should be as simple as setting that property to NO on the SDImageCache singleton and then just using -sd_setImageWithURL: method, right?

@rromanchuk
Copy link
Contributor

@KiranPanesar seems to be working for me. @mallorypaine do you know what this means in terms of performance in FPS on a standard scrollview? About to do some profiling, but just wondering if you knew off hand?

@mallorypaine
Copy link
Author

@rromanchuk it will have zero impact on the scrollview's scrolling performance in terms of frame rate. the only impact this change will have is that images will take longer to load (and appear in your scrollview) since they aren't being stored in the cache.

@rromanchuk
Copy link
Contributor

@mallorypaine makes sense, thx

@ghost
Copy link

ghost commented May 6, 2015

I've implemented this change and have verified that the images are never loaded from memory, but I'm still getting the spikes (sometimes 100MB+) when some images are first loaded into the imageviews in my tableview.

@rromanchuk
Copy link
Contributor

@mallorypaine just anecdotally, turning NSCache off fixes the memory problem for me, but there is an obvious new animation stutter when scrolling (fullscreen paging), but i'm sure it's just a developer error that was conveniently being hidden under the surface which is now being exacerbated now that NSCache is turned off

@bpoplauschi
Copy link
Member

Guys, really appreciate the work here. We have replaced this with a mergeable solution #1217

@bpoplauschi bpoplauschi modified the milestones: 3.7.4, 4.0.0 Dec 17, 2015
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

Successfully merging this pull request may close these issues.

None yet

4 participants