Top "Retain-cycle" questions

A retain cycle is a situation in reference-counted memory management when two (or sometimes more) objects have strong references to each other.

How to Correctly handle Weak Self in Swift Blocks with Arguments

In my TextViewTableViewCell, I have a variable to keep track of a block and a configure method where the block …

ios swift retain-cycle
Understanding retain cycle in depth

Lets say we have three objects: a grandparent, parent and child. The grandparent retains the parent, the parent retains the …

ios objective-c memory-management automatic-ref-counting retain-cycle
Using weak self in dispatch_async function

I read a lot of posts about using __weak self inside dispatch_async, and now I am a litle bit …

ios objective-c-blocks weak-references retain-cycle
Referring to weak self inside a nested block

Suppose I already create a weak self using __weak typeof(self) weakSelf = self; [self doABlockOperation:^{ ... }]; Inside that block, if I …

ios memory-management automatic-ref-counting block retain-cycle
Weak Reference to NSTimer Target To Prevent Retain Cycle

I'm using an NSTimer like this: timer = [NSTimer scheduledTimerWithTimeInterval:30.0f target:self selector:@selector(tick) userInfo:nil repeats:YES]; Of …

objective-c automatic-ref-counting nstimer retain-cycle
Capturing 'self' strongly in this block is likely to lead to a retain cycle

I have reqest with block. But the compiler issues a warning "Capturing 'self' strongly in this block is likely to …

ios objective-c automatic-ref-counting objective-c-blocks retain-cycle
Do we need to use __weak self inside UIAnimationBlocks in ARC?

Do we need to use __weak self inside UIAnimation Blocks as given below? Whether it will create retain cycle issue …

ios automatic-ref-counting objective-c-blocks retain-cycle
Is the weakSelf/strongSelf dance really necessary when referencing self inside a non-retained completion called from a UIViewController?

Say I have the following method inside a UIViewController subclass: - (void)makeAsyncNetworkCall { [self.networkService performAsyncNetworkCallWithCompletion:^{ dispatch_async(dispatch_get_…

ios objective-c uiviewcontroller objective-c-blocks retain-cycle
Retain Cycle in ARC

I have never worked on non ARC based project. I just came across a zombie on my ARC based project. …

objective-c xcode automatic-ref-counting retain-cycle