Self managing/releasing objects reported as "Potential leak of object" under Xcode -> Product -> Analyse
The Analyse feature of Xcode 4 is really great. The only problem is it thinks that objects that you initialise that are supposed to release themselves are reported as memory leaks.. ie how do you prevent it thinking this is a memory leak?
@interf开发者_运维技巧ace BackgroundTaskThing
+ doBackgroundTask: (NSString*) something {
BackgroundTaskThing* b = [[BackgroundTaskThing alloc] init];
[b setSomething: something];
[b runTask];
}
....
- (void)taskComplete {
[self release];
}
@end
From here, section Controlling 'Static Analyzer Diagnostics':
#ifndef __clang_analyzer__
// Code not to be analyzed
#endif
(not that i encourage this, but it is one way to disable it)
精彩评论