Meta's Automatic memory leak detection on iOS
Original post Automatic memory leak detection on iOS
Article Summary
Grzegorz Pstrucha from Facebook reveals how manual memory leak detection was eating up engineering time. His team built three open-source tools that automate the entire process.
Facebook's iOS app faced constant memory leaks from dozens of engineers working across the codebase. Traditional Instruments-based detection required tedious manual work for every check. The team built an automated system that finds retain cycles at runtime and assigns fixes to the right developers.
Key Takeaways
- Uses graph traversal to detect retain cycles automatically at runtime
- FBAllocationTracker monitors all NSObject allocations with minimal overhead
- Backend clusters related cycles and auto-assigns tasks via git blame
- FBMemoryProfiler enables in-app profiling without plugging into a computer
- Generation tracking snapshots living objects between markers for leak analysis
Facebook open-sourced three tools (FBRetainCycleDetector, FBAllocationTracker, FBMemoryProfiler) that automatically find and route iOS memory leaks without manual intervention.
Continue reading
This page summarizes “Automatic memory leak detection on iOS” by Meta, published Apr 13, 2016. All credit for the original work goes to the authors.