OCiosiosiosmacosiosios(1)OC””1(2)()Cocoaalloc,copyretainCocoa””(retainCount)10Cocoa””(retainCount)10deallocdealloc0dealloc(0)-(void)dealloc{[namerelease];[superdealloc];}dealloc[superdealloc];alloc1alloccopy1retain1release1autorelease111allocPerson*person1=[[Personalloc]initWithName:@””];NSLog(@”nameis%@”,person1.name);//person1[person1release];2Person*person2=[Personalloc]initWithName:@””];NSString*name=person2.name;NSLog(@”%@”,name);//person2[person2release];namenameautorelease1+(id)personWithName:(NSString*)aName{Person*person=[[Personalloc]initWithName:aName];returnperson;}2+(id)personWithName:(NSString*)aName{Person*person=[[Personalloc]initWithName:aName];[personrelease];returnperson;}+(id)personWithName:(NSString*)aName{Person*person=[[Personalloc]initWithName:aName];[personautorelease];returnperson;}-(void)printHello{NSString*str=[NSStringstringWithFormat:@”Hello”];NSLog(@”%@”,str);}@interfacePerson:NSObject{NSString*name;}-(void)setName:(NSString*)aName{if(name!=aName){[namerelease];name=[aNameretain];//orcopy}}retainrelease.-(NSString*)name{returnname;}-(void)printName{NSString*name=person.name;NSLog(@”%@”,name);}1-(void)reset{NSString*newName=[[NSStringalloc]initWithFormat:@”theNew”];name=newName;[newNamerelease];}name2-(void)reset{NSString*newName=[[NSStringalloc]initWithFormat:@”theNew”];[selfsetName:newName];}3-(void)reset{NSString*newName=[NSStringstringWithFormat:@”theNew”];[selfsetName:newName];[newNamerelease];}newNameautoreleasenewNamereleaseretainalloccopyreleaseautoreleasecopyretainallocreleaseautoreleasedeallocautoreleasereleaseSDKInstrument(google)