Skip to content

Retain cycle in RotatingSegue animation group #3

@mpkeefe

Description

@mpkeefe

I've been using the RotatingSegue example in my app. I did a heap shot analysis with the steady state being before rotating forward and then snapshotting the heap after rotate forward and rotate back. I found that the RotatingSegue was not being dealloc'd (and thus responsible for holding onto my custom view controller and in turn a bunch of other objects).

In the end I noticed that
(a) the animation group delegate is a strong reference, the .h file states that it will last as long as the animation and
(b) the example code -[RotatingSegue animationWithDuration:] includes the line

group.removedOnCompletion = NO;

This statement overrides the default value. Commenting out the line allows the animation to be removed normally, the strong reference cycle broken, and the Segue to cleanup. Everything seems to still work fine.

This leaves one to wonder, what was the reason for overriding the default here? Is it unintentional?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions