//The string here is a constant area without a reference count /*There are many types of touches under the NSString class, each with a different function, such as: [NSString stringwithformat:@ "Lanou"] when @ "Lanou" is less than a certain length, there is a constant area, and the maximum value of the integer is returned when @ "Lanouf DSFDSF "is to open up space in the heap area so there is a reference count when [NSString stringwithformat:@" until "] @" Kanji "is also open space in the heap area, there is a reference count [[NSString alloc] Initwit STR in HSTRING:STR] is the object string, which is a space in the heap area nsstring *string = [[NSString alloc] initwithstring:@ "Kaokao"]; this is nsstring under the class touch execution, The address of the constant area is returned*/NSString*STR = [NSString stringWithFormat:@"until"]; NSString*string= [[NSString alloc] initwithstring:str];//NSLog (@"%lu",[stringRetaincount]); [stringrelease]; NSLog (@"%lu", [str retaincount]); NSString*STR1 = [NSString stringWithFormat:@"FD"]; NSLog (@"%ld", [str1 Retaincount]); //When the unsigned LU is the maximum value of the output integer, when the signed LD is -1}
NSString reference count issues in iOS (-1 and integer maximum)