3

I am using SDWebImageDownloader in my iOS 7 app to download images from the web. I am not using SDWebImageManager, only the downloader, which is not supposed to cache anything on my behalf.

As more and more images are downloaded, my apps memory usage slowly climbs up and up approaching 100 MB with no end in sight. This memory is never freed up, and occurs even when nothing is saved to the cache. As such, it makes me think the downloaded images are being held in memory by SDWebImageDownloader somehow. Does anyone know how to clear this memory?

UPDATE My assumption that the issue was due to the SDImageDownloader was incorrect. Every time an image downloaded, I converted the image to a smaller size, and stored that image in SDImageCache. I had ruled out SDImageCache because I had attempted to regularly clear the memory cache, which had no effect on the memory climbing. However, I just deleted the line that calls it, and no more memory problem.

This leads me to a new question: How do I use SDImageCache without the memory climbing so high? I have no need for the memory cache functionality, just the disk caching functionality. However, there does not seem to be a way to clear the memory cache, and the disk cache seems to be taking up way more memory than the reduced sized images would take up otherwise. Where is this memory usage coming from?

josephap
  • 2,075
  • 17
  • 24
  • What are you doing with the images after you download them? Are they just written to a file and discarded or used in the app somewhere? – Stakenborg Jan 30 '14 at 20:40
  • @Stakenborg - I store a reduced-size version of the image in SDImageCache after downloading it. I originally thought it was free of blame, but that is not the case. After deleting the line, I found that it is the source of the memory climbing. I am just at a loss now as to how to use the disk cache without running into this issue. – josephap Jan 30 '14 at 22:21
  • Not so much an answer as a redirection, but: https://github.com/rs/SDWebImage/issues/538 – Stakenborg Jan 30 '14 at 22:46
  • What happens if you run instruments versus a device instead of the sim? Some users are saying it's a sim problem. – Stakenborg Jan 30 '14 at 22:47
  • @Stakenborg, I am looking into that post. I have not been running the app in the simulator, but rather on the device and using the Debug Navigator tab in the left sidebar of Xcode 5. It shows how much memory the app is using in real time. – josephap Jan 31 '14 at 16:54

0 Answers0