What are “strong” and “weak” references? Why are they important and how can they be used to help control memory management and avoid memory leaks?
Answer / Manish Kumar
In Objective-C, strong and weak references are used for managing object memory. A strong reference increases the retain count of an object, preventing it from being deallocated until there are no more strong references. Weak references do not increase the retain count of an object and allow the object to be deallocated when it has no strong references or any other weak references pointing to it. By using weak references, you can prevent circular references that would cause memory leaks. You can use weak references to make sure that your code does not maintain strong references to objects that are owned by another object or a view controller, which may be deallocated before your own object.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the use of double question marks (“??”) ?
What is the 'interface' and 'implementation'?
Arc is compile time or run time feature?
what does @synthesize do?
What is UIApplication?
Will iphone 6s get ios 14?
What is nslayoutanchor?
Explain the usage of struct?
What is dynamic typing in iOS operating system?
Difference between coredata & sqlite?
what is the difference between bounds and frame?
What's fast enumeration?