C developer interview

IOS developer Interview questions


By default, any variable that points to another object does so with what is referred to as a “strong” reference. A retain cycle occurs when two or more objects have reciprocal strong references (i.e., strong references to each other). Any such objects will never be destroyed by ARC (iOS’ Automatic Reference Counting). Even if every other object in the application releases ownership of these objects, these objects (and, in turn, any objects that reference them) will continue to exist by virtue of those mutual strong references. This therefore results in a memory leak.

Reciprocal strong references between objects should therefore be avoided to the extent possible. However, when they are necessary, a way to avoid this type of memory leak is to employ weak references. Declaring one of the two references as weak will break the retain cycle and thereby avoid the memory leak.

To decide which of the two references should be weak, think of the objects in the retain cycle as being in a parent-child relationship. In this relationship, the parent should maintain a strong reference (i.e., ownership of) its child, but the child should not maintain maintain a strong reference (i.e., ownership of) its parent.

For example, if you have Employer and Employee objects, which reference one another, you would most likely want to maintain a strong reference from the Employer to the Employee object, but have a weak reference from the Employee to thr Employer.



Share this article





Related Posts



Latest Posts
NHS Nursing Assistant interview questions
NHS Nursing Assistant…
The National Health Service offers professional…
New Grad nurse interview questions
New Grad nurse…
Dear nursing applicant: It’s tough getting…
What do you mean by Aptitude?
What do you mean…
Identifier: youi00clev Title: You and…
Investment Banking Analyst Interview questions
Investment Banking…
I was in your shoes about 5-6 years ago…
Academic Aptitude test questions
Academic Aptitude…
At the back of the complex, southwest…
Search
Featured posts
  • Oracle SQL developer Interview questions
  • Java web developer Interview questions
  • Salesforce developer Interview questions
  • Applications developer Interview questions
  • UX Designer interview questions
  • Development Interview questions
  • Inside sales interview questions
  • How to answers teacher interview questions?
  • Amazon technical interview questions
Copyright © 2024 l www.floydfairnessfund.org. All rights reserved.