Sure. In fact, this is not so rare, although you cannot understand it.
For example, suppose my controller is making a network request, and I really need to make sure that I handle the response, even if the user has switched from that controller.
I could do something like this:
- (void)doNetworkThing { __block MyController *blockSelf = self; NSURLRequest *request =
This introduces a trivial save cycle in which self blockSelf itself to save by assigning itself to the strong blockSelf pointer. As long as blockSelf does not go beyond, I will not free myself.
Note that often you should use a weak pointer in this situation. But if you really need a controller to handle it, using a strong pointer also works. As soon as the handler block is freed, its link to blockSelf will disappear. Since the link to the blockSelf stack blockSelf also disappear, it will be freed if no one holds it.
Basically, blockSelf triggered a time save cycle, which was useful to ensure that the release could not happen until the request was complete. Since ARC automatically clears the hold counter when the __block variable goes out of scope, it is not very similar to a save loop. But nonetheless what it is.
source share