gpt4 book ai didi

iphone - 释放和自动释放

转载 作者:行者123 更新时间:2023-11-28 18:44:19 24 4
gpt4 key购买 nike

告诉我 release 、 autorelease 、 drain 、 nil 和 null 之间的区别。什么时候调用应用程序的dealloc方法?

最佳答案

Release: Decrease retain count by 1

Autorelease: Deleayed release, will decrease retain count by 1 when the autoreleasepool is drained, which is most likely in the next run but not guaranteed.

Drain: To drain the autorelease pool

Nil: Null for objective C objects

Null: Null for C pointers.

只是回答@Kendall Helmstetter Gelner 所说的,当保留计数达到 0 时将调用 dealloc 方法。

关于iphone - 释放和自动释放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6798390/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com