https://stackoverflow.com/questions/7678469/should-iboutlets-be-strong-or-weak-under-arc/7729141#7729141
…the outlets to subviews of the view controller’s view can be weak, because these subviews are already strongly owned by the top-level object of the nib file.
However, when an Outlet is defined as a weak pointer and the pointer is set, ARC calls the runtime function:
1 |
id objc_storeWeak(id *object, id value); |
This adds the pointer (object) to a table using the object value as a key. This table is referred to as the weak table. ARC uses this table to store all the weak pointers of your application. Now, when the object value is deallocated, ARC will iterate over the weak table and set the weak reference to nil.
Alternatively, ARC can call:
1 |
void objc_destroyWeak(id * object) |
Then, the object is unregistered and objc_destroyWeak calls again:
1 |
objc_storeWeak(id *object, nil) |
This book-keeping associated with a weak reference can take 2–3 times longer over the release of a strong reference. So, a weak reference introduces an overhead for the runtime that you can avoid by simply defining outlets as strong.