Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Grand Central Dispatch In-Depth: Part 2/2

Concurrency is a tough topic. Learn about Grand Central Dispatch in-depth in this two part tutorial series.


This is a companion discussion topic for the original entry at http://www.raywenderlich.com/63338/grand-central-dispatch-in-depth-part-2

Thanks so much for this tutorial. I have a question regarding weak self in dispatch resources example. It looks like weak self is not necessary, because self doesn’t have a strong reference to the blocks, therefore no strong reference cycle is created.

@davydliu Try removing the __weak keyword and then try printing the retain count of weakSelf in the debugger.

po [weakSelf retainCount]

Do it again with the __weak keyword in there. weakSelf will get retained if __weak is not used potentially causing a reference cycle (Doesn’t really matter though since the instance of PhotoCollectionViewController is always in use).

The block does retain self, however my point being self doesn’t retain block. So there should be a cycle here, right?

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]