
What is potential leak of an object XCode?

Potential leak - This is a memory leak error that can be detected when you gives the command "Build and Analyze". This checks for all the memory leaks in the application.
And when it throw an error saying "Potential leak of an object" that means you somewhere forget to release it. You can easily fix such kind of error by just releasing/autoreleasing the object that has been alloc in the memory.

for example, the given code will throw a memory leak error.
- (NSString *) doIt
{
NSString *var = [[NSString alloc] init];
return var;
}
But it can be fixed by releasing the object. See below..
- (NSString *) doIt
{
NSString *var = [[NSString alloc] init];
// return var;
return [var autorelease];
}