SoundCloud Nov 23, 2018

Integration Testing for Memory Leaks

Article Summary

Matthew Healy from SoundCloud reveals how his team catches memory leaks across entire feature modules with a single test. Unit tests miss the bugs hiding between classes.

The SoundCloud iOS team uses VIPER architecture for new features, creating multiple opportunities for memory leaks through delegates, observers, and closures. Traditional unit tests only cover individual classes, leaving interaction bugs undetected until production.

Key Takeaways

Critical Insight

One integration test per module catches memory leaks across all component interactions, providing better coverage with fewer tests than unit testing each class individually.

The article includes a subtle memory leak example that looks perfectly safe at first glance but creates a retain cycle through an injected dependency.