iOS face question 05-parent-child controller, memory management

Source: Internet
Author: User

Memory management, parent-child controller face questions

1. What is the use of establishing a parent-child relationship controller

Answer:1> monitor Screen Select

2> If you want to get to your current very small controller is located in the navigation controller must be with the outside of the larger controller to establish a parent-child relationship, in order to layer up the navigation controller

2. How is the third-party API used?

Answer:0> Open API for big companies

1>github the frame that someone posted above

2> third-party APIs are documented in official documentation, and are done in the official documentation step-by-step

3> refer to the sample program provided by the official

4> first create a project to try, and so familiar with, in the use of the project

3. List now familiar with iOS development library and third-party development library?

Answer: Friends Alliance (including third party login and share), gold map, Baidu Map, Afn,sdwebimage,mbprogresshub, mjextension, etc.

4. How to ensure that many people develop a memory leak check

Answer:1> Static analysis of code using analyze

2> to avoid unwanted trouble, multi-person development when possible using arc

5. How to do a singleton mode without automatic memory management

Answer: Basic steps to create a singleton design pattern

1> declares a static instance of a single object and initializes it to nil

2> creates a class factory method for a class, and generates an instance of the class only if the instance of the class is nil

2> implements nscopying compelling, overriding the Allocwithzone: method to ensure that the user does not produce another object when the object is allocated directly

3> covers the release, Autorelease, retain, Retaincount methods to ensure the status of a singleton.

4> in a multithreaded environment, be careful to use the @synchronized keyword or gcd to ensure that a static instance is created and initialized correctly

6. For class methods (static methods) The default is Autorelease, will all class methods do this?

Answer the:1> system comes with a large number of methods returned by the method of the object, are Autorelease

What is the difference between the use of 7.block in Arc and MRC and what should be noted

Answer:1> for blocks that do not reference external variables, whether in arc or non-arc, the type is

__nsglobalblock__, this type

2> both arc and Mrc,block should have a copy operation to hold

3> should be careful to avoid circular references

@1>arc:__weak/__unscafe_unretained

@2>mrc:__block

8. Under what circumstances can a memory leak and memory overflow occur?

Answer: Memory leak: The release is not released. When the program after the application memory, unable to free the requested memory space (such as an object or a variable is not released after use, the object has been occupied by memory), a memory leak danger can be Huri, but the memory leak accumulation of serious consequences, no matter how much memory, sooner or later the light is occupied.

Memory leaks can eventually cause memory overflow

Memory overflow: Full memory, not enough.

When the program in the application memory, there is not enough memory space for its use, appear out of memory;

For example, to apply for an int, but to save it a long to save the number, that is memory overflow

9.[nsarray Arraywithobject:<id>] Does this method need to be freed after adding an object?

Answer: No, this object is released into the automatic cache pool

How does 10.JSON data parse, and is there a memory leak when parsing data? Some words how to understand

Answer: 1>json analytic solution

@1>sbjson

@2>jsonkit

@3>nsjsonserialization

11. How does the auto-release tank bottom layer be implemented?

Answer: The auto-release pool is implemented as a stack: When you create a new auto-free pool, it is added to the top of the stack. When an object receives a send Autorelease message, it is added to the current thread at the top of the stack for auto-free eating, and when the auto-free eat is recycled, they are removed from the stack, and all objects inside the pool are given a release operation

iOS face question 05-parent-child controller, memory management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.