<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>mikeash.com pyblog/friday-qa-2011-05-20-the-inner-life-of-zombies.html comments</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-05-20-the-inner-life-of-zombies.html#comments</link><description>mikeash.com Recent Comments</description><lastBuildDate>Mon, 17 Aug 2026 10:26:02 GMT</lastBuildDate><generator>PyRSS2Gen-1.0.0</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Avi - 2011-05-20 17:58:04</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-05-20-the-inner-life-of-zombies.html#comments</link><description>"Can you overload (or swizzle if need be) the dealloc of specific classes to turn them into zombies by setting the isa yourself."
&lt;br /&gt;
&lt;br /&gt;Yep. Zombification isn't something that only Apple can do. Chrome/Chromium keeps a running treadmill of zombies to catch errors. See the code at
&lt;br /&gt;
&lt;br /&gt;&lt;a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/cocoa/objc_zombie.h?view=log"&gt;http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/cocoa/objc_zombie.h?view=log&lt;/a&gt;
&lt;br /&gt;&lt;a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/cocoa/objc_zombie.mm?view=log"&gt;http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/cocoa/objc_zombie.mm?view=log&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;It's pretty flexible; it allows you to have a running treadmill, only zombify certain classes, and more.</description><guid isPermaLink="true">ee3ea71425bb1539d39949f207c0cba8</guid><pubDate>Fri, 20 May 2011 17:58:04 GMT</pubDate></item><item><title>Scott Morrison - 2011-05-20 17:40:16</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-05-20-the-inner-life-of-zombies.html#comments</link><description>As you said, one of the problems with running with zombies enabled is that it consumes a huge amount of memory.  This means that if you have an overrelease that occurs some time into the execution of your code, enabling zombies may not help because all your system resources get eating zealously creating zombies.
&lt;br /&gt;
&lt;br /&gt;If you suspect/know that the overreleased object is of a certain class, is there a way to zombie only that class.  eg  NSString -- I would know this is overreleased because  at some point in the code, code starts sending it string methods messages (but by this time it is reused as a NSData object for example)  eg [NSData doesNot respond to selector stringByAppendingString: ]
&lt;br /&gt;
&lt;br /&gt;Can you overload (or swizzle if need be) the dealloc of specific classes to turn them into zombies by setting the isa yourself.
&lt;br /&gt;
&lt;br /&gt;This keeps memory consumption down -- but helps you identify the object that actually was over released -- and possibly where.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description><guid isPermaLink="true">136367e1a0302553ed9fda9659bbfef0</guid><pubDate>Fri, 20 May 2011 17:40:16 GMT</pubDate></item><item><title>Peter Hosey - 2011-05-20 17:08:54</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-05-20-the-inner-life-of-zombies.html#comments</link><description>&lt;div class="blogcommentquote"&gt;&lt;div class="blogcommentquoteinner"&gt;This is why one of the most common symptoms of a memory management error is a mystery object, like a random NSString, showing up where you expected to see something else.&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;It's worth including, for the benefit of searchers, that this typically manifests as a console message along the lines of “-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x1c2b3a40”, where the class will be just about any random class and the selector will be one appropriate for a message to the object you meant to message (the one that died and has been succeeded, in this example, by a string).
&lt;br /&gt;
&lt;br /&gt;Great post; thank you for writing and publishing it.</description><guid isPermaLink="true">e3ef634a531d9d2f74114daaf49e42b2</guid><pubDate>Fri, 20 May 2011 17:08:54 GMT</pubDate></item></channel></rss>
