Memory Leak和Zombie有什么区别? [英] What is the difference Memory Leak and a Zombie?

查看:77
本文介绍了Memory Leak和Zombie有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事基于ARC的项目.我从未从事过基于非ARC的项目.最近我

I am working on a ARC based project . I have never worked on Non ARC based project .Recently I

在启用了ARC的项目中遇到僵尸.据我了解,不会有内存

came across a zombie in my ARC enabled project.As far as I understood there wont be memory

在ARC中泄漏,因为对象将自动释放.但是我遇到了一个僵尸

leaks in ARC , as the objects will be deallocated automatically.But I came across a zombie

说传递给已释放实例的消息".我的困惑是等效于内存泄漏

saying "message passed to a deallocated instance".My confusion is is a Memory Leak equivalent

僵尸.如果真是这样,那么ARC中也会发生内存泄漏吗?有帮助吗?

to a Zombie. If that is the case then Memory Leak occur in ARC too ? Any help ?

推荐答案

Objective-C的僵尸"与泄漏相反.泄漏是您已不再有任何引用的已分配内存的一部分,因此您无法释放它.僵尸是已被释放的对象,但仍然存在对它的引用,并且仍在向其发送消息(这可能导致各种不可预测的行为).

"Zombies" in Objective-C parlance are the opposite of leaks. A leak is a bit of allocated memory that you no longer have any references to, so you can't free it. A zombie is an object that has been deallocated, but references to it still exist and messages are still being sent to it (which can lead to all sorts of unpredictable behavior).

这篇关于Memory Leak和Zombie有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆