gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSZombie


From: Sergey Golovin
Subject: NSZombie
Date: Sat, 26 Jun 2010 16:15:41 +0400

Hi!

Perhaps I passed some changes. I have a trouble  with the following program:

------------------------------------------------------------------------------------------------------------------------
  #import <Foundation/Foundation.h>

  int main(int argc, char **argv, char **env) {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSObject *anObject = AUTORELEASE([NSObject new]);

    RELEASE(anObject);
    RELEASE(anObject);
    [pool release];

    return 0;
  }
------------------------------------------------------------------------------------------------------------------------

I get the segmentation fault with NSZombieEnabled=NO as supposed.
But I get nothing with NSZombieEnabled=YES.

Is it a valid behavior?

The documentation states:
------------------------------------------------------------------------------------------------------------------------

 Turning on zombies changes this behavior so that the isa pointer                                                      
 is modified to be that of the NSZombie class.  When messages are                                                         
 sent to the object, instead of crashing, ****NSZombie will use NSLog()**** to                                                    
 produce an error message.  By default the memory used by the object                                                      
 will not really be freed, so error messages will continue to                                                             
 be generated whenever a message is sent to the object, and the object                                                    
 instance variables will remain available for examination by the debugger.

------------------------------------------------------------------------------------------------------------------------


--
Sergey Golovin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]