Will this leak under ARC? [closed]
-
13-07-2021 - |
Frage
I have a question regarding how ARC works. I have started working on IOS recently, I have created my project with ARC, As per documentation, ARC would take care of freeing memory by keep tracking reference count. Consider I have picker view ivar, when corresponding view is popped it will get freed, what if the case I explicitly set to nil and create again like this...
audio_cap_picker = nil;
// Creat picker view.
if (audio_cap_picker == nil) {
audio_cap_picker = [[UIPickerView alloc] init];
audio_cap_picker.delegate = self;
audio_cap_picker.showsSelectionIndicator = YES;
[self.view addSubview:audio_cap_picker];
}
If I do every time like this, will the memory get freed, or it will leak.
Lösung
That code is fine under ARC. It will not leak.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow