2014年2月26日

关于release后retainCount还是1的问题

摘要: 转自:http://www.cocoachina.com/bbs/read.php?tid=175523realse之后再调用还能调用的的问题,我做了这么多年也是经常遇到,也曾经试图寻找原因,就像6楼说的,很多时候都会出现realse过后还能调用的现象。而且对象不是autorealse的。我还遇到过奇葩的是,每次要等上好几秒钟再调用才会出现空指针异常。(代码里绝对没有手动多线程)还有很多时候跟你测试的硬件环境还有关,可以说,ios的内存管理策略虽然一如既往的是一套,但是每个版本都有细微的变化,使用中还是能感觉出来,只是没有官方的说明,无法正确的解释。不过随着一些界面业务该用autoreleas 阅读全文

posted @ 2014-02-26 14:04 王培 阅读(506) 评论(0) 推荐(0) 编辑

(oneway void) release中oneway的意思

摘要: oneway is used with the distributed objects API, which allows use of objective-c objects between different threads or applications. It tells the system that it should not block the calling thread until the method returns. Without it, the caller will block, even though the method's return type is 阅读全文

posted @ 2014-02-26 13:10 王培 阅读(485) 评论(0) 推荐(0) 编辑

Objective-C的内存管理(一)黄金法则的理解

摘要: 转自:http://blog.csdn.net/lonelyroamer/article/details/7666851一、内存管理黄金法则:The basic rule to apple is everything thatincreases the reference counter with alloc,[mutable]copy[WithZone:] or retainis in charge of the corresponding [auto]release.如果一个对象使用了alloc,[mutable] copy,retain,那么你必须使用相应的release或autonre 阅读全文

posted @ 2014-02-26 11:41 王培 阅读(316) 评论(0) 推荐(0) 编辑

导航