- 浏览: 570444 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
JYY282:
[i][/i]
Ecshop与Shopex的比较 -
qq247890212:
我也遇见这问题了,真诡异。重新下载个猫换了就好了。 太浪费时间 ...
诡异:ClassNotFoundException: org.springframework.web.filter.CharacterEncoding
From: http://developer.apple.com/library/mac/#qa/qa1367/_index.html
Finding EXC_BAD_ACCESS bugs in a Cocoa project
Q: How do I find EXC_BAD_ACCESS
bugs in a Cocoa project?
A: How do I find EXC_BAD_ACCESS
bugs in a Cocoa project?
This kind of problem is usually the result of over-releasing an object. It can be very confusing, since the failure tends to occur well after the mistake is made. The crash can also occur while the program is deep in framework code, often with none of your own code visible in the stack.
Summary
To avoid problems like this, you must follow the Cocoa memory management rules. Refer to ADC's document "Memory Management Programming Guide for Cocoa". The section “Object Ownership and Disposal” describes the primary policy.
Important Factors
-
If you directly allocate, copy, or retain an object, you are responsible for releasing the newly created object with
release
orautorelease
. Any other time you receive an object, you are not responsible for releasing it. -
A returned object is normally guaranteed to remain valid within the method it was received in (exceptions include multithreaded applications and some Distributed Objects situations). That method may also safely return the object to its invoker.
-
If you need to store a returned object in an instance variable, you must retain or copy it.
-
Use
retain
andautorelease
when needed to prevent an object from being invalidated as a normal side-effect of a message. -
If you instantiate an object using a convenience method, the object is already slated for
autorelease
. Do not send arelease
or anautorelease
message to this object. -
Never send a
dealloc
message to the object. This may dispose of the object but it does so regardless of the current reference count. Any other object that has retained the deallocated object is left with an invalid reference. -
Never make any assumptions on how or in what order autoreleased objects are disposed.
Technical Documentation
For information on a debugging tool called NSZombieEnabled
to help isolate this kind problem, as well as other debugging tips, refer to:
Technical Note 2124 Mac OS X Debugging Magic
This topic is also mentioned in the ADC Reference Library documentation:
For an overview of Cocoa objects and their life cycles refer to the following guide:
The Life Cycle of a Cocoa Object
Document Revision History
2006-10-10 |
New document that discusses how to find memory protection violations or EXC_BAD_ACCESS bugs in Cocoa projects. |
发表评论
-
Objective-C 与 C++ 的异同
2013-04-02 12:03 1360http://www.cnblogs.com/y041039 ... -
Cocos2D-X是全球知名的开源跨平台手机游戏引擎
2013-01-22 10:05 2711http://www.oschina.net/p/cocos ... -
iOS Keyboard 键盘高度变化 自适应
2013-01-15 15:43 3220[[NSNotificationCenter default ... -
iOS使用自定义字体
2012-11-27 12:11 12083From: http://blog.csdn.net/csy1 ... -
4 款类似 Facebook/Path 切换效果的 iOS 组件
2012-11-27 12:03 2097From: http://blog.csdn.net/lia ... -
Path 2.0的UI界面设计详细介绍
2012-11-27 11:56 1430如Path的创始人Dave Morin ... -
史上最全的App Store邮箱列表
2012-11-27 11:51 1229From: http://roybaby.blog.51cto ... -
iOS从info.plist 获取项目的名称及版本号
2012-11-16 10:54 1578From: http://blog.sina.com.cn/s ... -
MapKit annotation drag and drop with callout info update
2012-10-13 10:38 2365http://hollowout.blogspot ... -
NSArray 或NSDictionary 调用writeToFile方法失败原因
2012-08-31 10:03 4424NSArray 或NSDictionary 调用writeTo ... -
如何让IOS应用从容地崩溃
2012-08-30 15:25 1574From: http://www.cocoachina.com ... -
iOS中判断设备系统版本
2012-08-29 17:17 31671在iOS开发中,经常要考虑系统的向下兼容,如果使用 ... -
iOS 汉字转拼音
2012-08-21 16:42 1427From: http://www.cnblogs.com/v2 ... -
iOS模拟器截图工具
2012-08-17 16:35 1592From: http://magicalboy.com/ios ... -
XCode下的iOS单元测试
2012-08-10 17:47 1123From: http://mobile.51cto.com/ ... -
AFNetworking
2012-08-08 10:54 4624AFNetworking on github: https:/ ... -
Wrapping Conventions
2012-08-01 15:54 781Wrapping Conventions ... -
Core Animation如何使显式动画结束时的值直接作用Layer
2012-08-01 14:51 3752(1)使用隐式动画会直接改变layer的属性值,如: ima ... -
How To Debug Memory Leaks with XCode and Instruments Tutoria
2012-07-31 16:30 1020From: http://www.raywenderlich. ... -
Using Properties in Objective-C Tutorial
2012-07-31 16:27 882From: http://www.raywenderlich. ...
相关推荐
From_LNK_to_RCE:Finding_bugs_in_Windows_Shell_Link_Parser 应急响应 AI 安全威胁 自动化 信息安全研究
信息安全_数据安全_Women_in_Cybersecurity:Finding,_ 信息安全 云安全 业务风控 安全开发 安全测试
信息安全_数据安全_Finding_Treasures_in_the_ToyBox 安全芯片 漏洞分析 风控 应急响应 风控
its code for finding location in j2me
论文最新,想学习的小伙伴可以看看哦,一起学习一起分享
Polynomial Root Finder is a reliable and fast C program (+ Matlab gateway) for finding all roots of a complex polynomial.
matlab导入excel代码utl_vectorized_solution_to_finding_first_element_in_a_row_meeting_criterion 查找连续满足条件的第一个元素的矢量化解决方案。 关键字:sas sql join合并大数据分析宏oracle teradata mysql ...
finding alphas a quantitative approach to building trading strategies MOBI电子书
Finding_Hidden_Processes.exe
finding no of clusters in kmeans using ratio of intra vs inter distances
find_part_location_image_location_image_finding_cutting_matlab_源码
checklist_finding_employment_pcc.pdf
a star method for finding path planning of a moving object
这些错误将包括不应再使用(不推荐使用)的标签,导致调试或掉毛错误的错误以及应避免的语法。 下面提供的资源将帮助您识别这些错误。资源 指示使用codeandbox克隆此仓库在打开一个新项目单击右上角的“创建沙箱”...
Amacom_-_Debugging_-_The_Nine_Indispensable_Rules_For_Finding_Even_The_Most_Elusive_Software_And_Hardware_Problems.pdf
信息安全_数据安全_Finding_the_Right_Answers—Facili 自动化 安全研究 内网安全 安全管理 安全审计
信息安全_数据安全_ast2-r02_strategies_to_finding_and_bui 安全加固 安全管理 安全研究 硬件攻防 安全编码
project mangment for direction of finding
esprit 测向 direction of arrival
Detect lanes using computer vision techniques.The following steps were performed for lane detection:* Compute the camera calibration matrix and distortion coefficients given a set of chessboard images...