NSString reference count issues in iOS (-1 and integer maximum)

Source: Internet
Author: User

                //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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.