简体   繁体   English

为什么在启用NSZombie时我会看到所有这些泄漏?

[英]Why am I seeing all these leaks when NSZombie is enabled?

I am nearing completion on my first app and I'm suddenly seeing that the app is causing memory leaks. 我的第一个应用程序即将完成,我突然发现该应用程序导致内存泄漏。 I have found a few leaks and fixed them. 我发现了一些泄漏并修复了它们。 Now there are no leaks but to my surprise when NSZombie is enabled it is showing more than 4000 leaks which are mainly from frameworks. 现在没有泄漏,但令我惊讶的是,当NSZombie启用时,它显示超过4000个泄漏,主要来自框架。

I am confused with the exact use of NSZombie. 我对NSZombie的确切用法感到困惑。 Is it only used for finding the zombies or is it in any way useful for finding leaks? 它只用于寻找僵尸还是以任何方式找到泄漏?

Here is a screenshot that shows all the leaks which are associated with the frameworks: 这是一个屏幕截图,显示了与框架相关的所有泄漏:

泄漏的屏幕截图

I believe the command line option 'NSDeallocateZombies' defaults to NO. 我相信命令行选项'NSDeallocateZombies'默认为NO。 So zombies are never deallocated and thus appear as leaks if zombies (NSZombiesEnabled) are on. 因此僵尸永远不会被释放,因此如果僵尸(NSZombiesEnabled)打开则会出现泄漏。 Never test for leaks with zombies on. 切勿用僵尸测试泄漏。 You can turn NSDeallocateZombies to YES as well but I'm not sure how that interacts with Instruments. 您也可以将NSDeallocateZombies转为YES,但我不确定它与Instruments的交互方式。 A zombie is a special object that responds to all messages with an exception. 僵尸是一个特殊对象,它响应所有带有异常的消息。 In order to make this useful it has to live a long time (so you can catch when you try to reuse a deallocated object) but that makes it look exactly like a leak. 为了使它变得有用,它必须存活很长时间(所以你可以在尝试重用已释放的对象时捕获它),但这使它看起来完全像泄漏。

if NSZombie is enable a "release" do not free the memory. 如果NSZombie启用“释放”,则不释放内存。 NSZombie is used for test if you use a object already released 如果您使用已发布的对象,NSZombie将用于测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iOS崩溃-无泄漏,启用了NSZombie且未发生异常中断 - iOS crash - no leaks, NSZombie enabled and doesn't breaking on exceptions 设置CIAdditionCompositing过滤器时,为什么会看到NSUnknownKeyException? - Why am I seeing an NSUnknownKeyException when setting up a CIAdditionCompositing filter? 在使用Core Plot构建iPhone应用程序时,为什么会看到以下链接器错误? - Why am I seeing the following linker errors when building an iPhone app with Core Plot? 将Core Data属性从Integer 16更改为String时,为什么会出现此错误? - Why am I seeing this error when changing a Core Data attribute from Integer 16 to String? 在为Pebble手表进行开发时,为什么在iOS上的-setAppUUID:上看到错误? - Why am I seeing an error on -setAppUUID: on iOS when developing for the Pebble watch? 为什么在 Apple 设备上解码 base64 文本字符串时会看到裁剪的图像? - Why am I seeing a cropped image when decoding a base64 text string on an Apple device? 启用了NSZombie,但仍然没有调试信息 - NSZombie Enabled but Still No Debug Info 为什么我看到黑屏? 我没有分配东西吗? - Why am I seeing a black screen? Did I not alloc something? 我不确定3个泄漏? - 3 leaks that I am unsure of? 为什么我看到有关NSAutoreleasePool不可用的消息警告? - Why am I seeing a message warning about NSAutoreleasePool being unavailable?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM