Tencent Music Tech Team
Tencent Music Tech Team
Jul 13, 2018 · Mobile Development

Analysis and Solutions for a Memory Leak Caused by a Repeating Animation in iOS

The article explains how a repeating iOS animation caused a hidden memory leak by retaining its view controller through a strong CABasicAnimation delegate and a performSelector‑afterDelay timer, and shows how replacing the delegate‑based animation with a CAKeyframeAnimation/CAAnimationGroup and using weak references or cancelling pending selectors eliminates the retain cycle.

CAAnimationMemory LeakObjective‑C
0 likes · 10 min read
Analysis and Solutions for a Memory Leak Caused by a Repeating Animation in iOS