Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (17 sloc) 1.39 KB

Lots of ALAsset images in UITableView

What causes stuttered scrolling?

  • Retrieving the thumbnail CGImageRef from ALAsset.
  • Scaling the thumbnail down from 150x150 to 80x80. Which is what UIImageView has to do when assigning an image of a different size.

What causes memory issues?

  • -[ALAssetsGroup enumerateAssetsUsingBlock:] uses a block, calling -[ALAsset thumbnail] returns an autoreleased CGImageRef, but releasing a pool and creating a new one once every N iterations is problematic, because the block tries to copy them over.
  • Preloading all thumbnails into memory.
  • Keeping bigger images in memory than needed. I.e. scale down.
  • When reusing a table view cell, does the UIImage memory get properly released?


  • Preload/scale N images in the direction the user is scrolling.
  • Perform preloading/scaling in thread, but possibly using the "future" pattern implemented in GCD so that scrolling superfast will simply make the table view wait until loading is done. This means that scrolling superfast could still show some stuttering, but that's the trade-off. Because simply skipping images is not an option in the case of an image picker.
  • Remove cached images, of the opposite direction the user is scrolling in, once a memory warning is received. Probably from a background thread as well.