iphone - memory leaks in my strings -


i have in code :

nsstring *mystring = @""; ....  if (...) { mystring = @" other string"; } ... mystring = @" other string "; 

is leak, please ?

sorry, guys, it's not autoreleased. it's not leaked, it's not autoreleased. code prove it:

nsautoreleasepool *pool = [[nsautoreleasepool alloc] init]; nsstring *str1 = @"first one"; //  nsstring *str2 = [nsstring stringwithformat:@"the %dnd", 2]; // autoreleasing string [pool drain];  nslog(@"%@", str1); // all's ok nslog(@"%@", str2); // exc_bad_access 

read strings created @"..." construction @ strings programming guide:

the compiler makes such object constants unique on per-module basis, , they’re never deallocated, though can retain , release them other object.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -