简体   繁体   中英

Best way to find retain cycle?

I have a nasty retain cycle in my iOS app. I'm looking at it in instruments and can see all of the retains/releases, but it's hard to track down exactly which retain is the one still holding on.

Does anyone have advice for finding exactly which retain is holding onto the reference?

Edit: Picture of the retain/releases:

You could check out if instruments detects the leak, like so: 在此输入图像描述

From the looks of it, though, that timer near the end of the list doesn't get released. Could you update your post with the code in setVideoState ?

Edit:

What I usually do is try and match up the retain/releases (instruments should actually do that for you, i think it was some filter in the menu to the left), while focusing on my code, because the frameworks usually have their things together. In your case, as you go down that list you see that the timer has +1 but never get released after that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM