Xcode comes with iOS test methods

Source: Internet
Author: User

Before talking about Xcode's own test method, the space division of the program in the deposit is divided into 5 parts:

#1. BSS segment, which holds uninitialized global variables. BSS is the abbreviation for English block Started by symbol. BSS segments belong to static memory allocations.

#2. Data segment, which holds the initialized global variables and global static variables. Data segment belongs to static memory allocation

#3. Code snippets, storing program execution code

#4. Heap, which stores the memory segments that are dynamically allocated in the process.

#5. Stack, which stores the function's parameter values and local variables, which are automatically allocated and freed by the compiler.

Often said memory management is the management of heap memory.

A memory leak is a space created by a dynamic allocation that is not released after use, or is not recycled until the program is completed.

Xcode comes with a set of test tools

Analyze-Static analysis

As location:

Automatically checks for the following error in your code:

#1. Whether an object was created, but not used

#2. Whether an object or pointer has been created and has not been read since it was initialized

#3. Whether to invoke a method that adds 1 to an object reference count, without invoking the reference count minus 1

#4. Whether there is an error return type.

After running, if you check to have the above error, there will be a blue hint,

The following is commonly used instruments, before using the best choice of real machine run do not select simulator

Opening instruments is selecting the profile from the first diagram above, which includes the following test functions:

We introduce the following commonly used instruments three-jie:

Leaks-Memory Leak check

This generally if have done static check analyze is less problem, run:

After opening the phone may be slower to run, to try to open the program under all the interface check. If there is a memory leak, the x symbol will appear on the leak check line.

Click the x symbol to see the detailed error message

Allocations-Memory allocation check

Interface such as

Time Profile-Runtime check

Can view the time-consuming projects, for more time-consuming projects can double-click the time-consuming project directly to the code

Point-and-click may be located in the code, the 301X logo shown in this code runs time-consuming 301ms, if there is more time-consuming code needs to be optimized

Here are some of the tools that Xcode has, but the most important thing is to pay more attention to the code specification.

Xcode comes with iOS test methods

Related Article

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.