My app is riddled with memory leaks concerning NSString objects. Never, ever do I use alloc to create an NSString object, yet according to Instruments (used with a real device) the app leaks NSString objects. This happens around uses of stringByAppendingString. Example of code:
NSString *documentsPathPlusSlash = [self.documentsPath stringByAppendingString:@"/"];
NSString *documentsPathPlusSlashAndFileName = [documentsPathPlusSlash stringByAppendingString:fileName];
mainMenuViewController.documentsPath = documentsPathPlusSlashAndFileName;
Once this was one long statement, so I thought maybe splitting it into separate lines would solve it. No such luck, the code above leaks NSString objects. Why is that? MainMenuViewController.dealloc does not release documentsPath, because that's not necessary. Or is it? The Apple documentation and various forums are not really helping.