XiaoKL

iOS.-.cxx_destruct

.cxx_destruct

 

-.cxx_destruct 方法: 该方法是由编译器生成的方法。

1. “ARC actually creates a -.cxx_destruct method to handle freeing instance variables. This method was originally created for calling C++ destructors automatically when an object was destroyed. The visible difference of this with ARC is that Objective-C instance variables are now deallocated after -dealloc in the root class has finished, not before. In most cases, this should make no difference.” R[1]

 

2. R[2] 链接中的内容充分说明了: "-.cxx_destruct" 是在其父类(这里可能有出入)的dealloc被调用后才被调用的。

 


Reference

1.  Objective-C Phrase Book, Second Edition [To Read]

http://my.safaribooksonline.com/book/programming/objective-c/9780132908641/3dot-memory-management/ch03

http://www.informit.com/articles/article.aspx?p=1806938&seqNum=12

 

2. Effective Objective-C 2.0: 52 Specific Ways to Improve Your iOS and OS X 

Item 30: Use ARC to Make Reference Counting 

http://books.google.com.hk/books?id=qp4ZXAmGaoQC&pg=PT185&lpg=PT185&dq=iOS+.cxx_destruct+crash&source=bl&ots=tYmMdkMg2t&sig=Jk4L0lHPTy8nPVfIEPUmkR7zNrE&hl=en&sa=X&ei=ZTJuUt3TA8SOkwXXvYDACQ&ved=0CGgQ6AEwCQ#v=onepage&q=.cxx_destruct&f=false

 

3. http://sweettolife.com/questions/12562058/arc-converted-app-crashing-with-last-call-to-cxx-destruct

posted on 2013-11-12 16:36  XiaoKL  阅读(1519)  评论(0编辑  收藏  举报

导航