How to locate exc_bad_access

Source: Internet
Author: User

There are some solutions to this problem on the Internet, but most of them are unclear. I will describe the specific steps based on my own practices.

1.

In the groups & files/executables folder of xcode, double-click, select arguments, select the following column, click "+", and add four variables named respectively: set nszombieenabled, mallocstacklogging, nsdebugenabled, mallocstackloggingnocompact, and value to yes.

2.

If exc_bad_access appears, the following information is displayed in the console prompt:

13:44:18. 300 aproject [4009: 207] ***-[cfstring class]: Message sent to deallocated instance 0x5e463b0

Enter shell malloc_history in the console4009 0x5e463b0. Here4009Is4009, Indicating the process number,0x5e463b0Is the above0x5e463b0Indicates the variable address of the error.

Press enter. The console will output some information, some of which begin with alloc or free. These are memory request or release records that contain messages sent to these objects. An error usually occurs in the last message starting with alloc or malloc. Find the last message written by yourself. The problem is this message. In this way, you can locate the line of code with an error.

Main reference: http://blog.sina.com.cn/s/blog_6cffce770100ub98.html

By zqzhuang

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.