Retain cycle example
Give me a concrete code example that creates a retain cycle, and fix it.
Give me a concrete code example that creates a retain cycle, and fix it.
A closure stored by self that captures self forms a self → closure → self cycle; break it with a [weak self] capture list. A closure is a reference type that keeps captured references strongly in its heap context, so the moment you store it, both directions are strong.
Memory and ARCMultiple choiceBasics
Which of these two snippets creates a reference cycle? …
#retain-cycle #closure #weak-self
Memory and ARCShort answerAdvanced
A UIKit ViewController keeps an upload completion block in a property, and the block…
#retain-cycle #closure #lifetime
Memory and ARCMultiple choiceBasics
Which of the following (with no extra measures) create a reference cycle or a permanent…
#retain-cycle #closure
Memory and ARCShort answerAdvanced
This code, which loads an image asynchronously in a UITableView cell, crashes now and…
#closure #lifetime