gpt4 book ai didi

ios - 是否应该为已发布的应用关闭 NSZombieEnabled?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:08:38 24 4
gpt4 key购买 nike

启用 NSZombieEnabled 后,它将提供一些保护措施,防止在运行时发生的 EXC_BAD_ACCESS 问题。

我正在做双重调查以确保没有/很少有内存泄漏,但我可能会过度释放,所以打开 NSZombieEnabled 将有助于防止这种情况发生,对吗?或者在 NSZombieEnabled 开启的情况下,所有内存释放操作都会被转换为空操作吗?那样的话就出大问题了。

最佳答案

不,您不应该使用 NSZombiesEnable。僵尸通过将释放对象的 isa 指针转换为“僵尸”类来工作。除非启用 NSDeallocateZombies,否则不会释放此对象的存储空间。因此,如果您启用僵尸程序,您可能会泄漏内存。

此外,Apple 表示不要在 NSDebug.h 中启用它:

Do not depend on the existance of any of these symbols in your code in future releases of this software. Certainly, do not depend on the symbols in this header in production code.

如果在AppStore上发布,我猜你不会通过审核。

关于ios - 是否应该为已发布的应用关闭 NSZombieEnabled?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8647432/

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