objective c - Overreleasing issue and Zombies -
This program crashes if I want to delete the release statements. I think I am overreleasing and realized that quickly But, just to test the zombies, I changed them to (NSAMBJANABLE = ESAS and CFGNElval = 16) and the program ran fine and did not throw exceptions.
What gives? I thought that turning on the corpse just told me whether I am a doofus ... it is not okay.
#import "AppController.h" @ Implementation AppController - (IBAction) countCharacters: (ID) sender {// does a button do this? If (! [Sender Hackindfclass: [NSBitton class]]) {NSLog (@ "% @ is not a button", sender); Return; } / Proceed NSString * userString = [textField stringValue]; NSNumber * Calculation = [NSNumber Numbers: [UserString Length]]; NSString * outputString = [NSString stringWithFormat: @ "'% @' has% @ characters.", Userstring, counting]; // [userString release]; // [counting continue]; [Labelfield set string value: outputstring]; // [output string release]; } @end
That's because you try to leave something You do not have any reference to them). Their ownership is given to the "nearest" NSAIDRepipal.
You can read about object ownership. Generally, you are not the owner if you have not called yourself to create an object in the form of a quick reference, or if you have not retained by
Maintain
with an object you become an owner; Calling Release
means you owe ownership (and will prohibit the object if it does not have any other owner).
You should not not not owned by you without releasing your current code exactly what you need.
Comments
Post a Comment