Pick the fix
An image-heavy feed gets memory warnings and is killed in the background. Best plan?
Hint 1 of 1
What does a decoded image cost?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Downsample to display size, cache in NSCache with a cost limit, and clear caches on warnings and backgrounding
Correct. It lowers peak memory and responds to pressure.
Why not the others?
- B Cache every image in a Dictionary for speed. A Dictionary never evicts, so memory only grows.
- C Load full-resolution images and rely on contentMode to shrink them. The full image is still decoded into memory.
- D Ignore warnings, because iOS manages memory. The system terminates apps that ignore pressure.