Retain cycles are one of the most common ways of creating memory leaks. It's incredibly easy to create a retain cycle, and tends to be hard to spot it. The goal of FBRetainCycleDetector is to help find retain cycles at runtime. The features of this project were influenced by Circle. FBRetainCycleDetector will look for cycles that are no longer than 10 objects. We can make it bigger (although it's going to be slower!). There could also be retain cycles that we would like to omit. It's because not every retain cycle is a leak, and we might want to filter them out. Every filter is a block that having two FBObjectiveCGraphElement objects can say, if their relation is valid. If you want to profile your app, you might want to have an abstraction over how to get candidates for FBRetainCycleDetector. While you can simply track it your own, you can also use FBAllocationTracker. It's a small tool we created that can help you track the objects.
Features
- FBRetainCycleDetector is built out from non-debug builds
- You'll be able to use FBRetainCycleDetector fully only in Debug builds
- Controlled by compilation flag that can be provided to the build to make it work in other configurations
- FBRetainCycleDetector will look for cycles that are no longer than 10 objects
- Track all allocations and force retain cycle detection from UI