- (NSString*) getProjectCoreName
{
return [NSString stringWithFormat:@"%@_%ld", kTLProject, sProjectCores++];
}
Instruments is telling me 32 bytes is leaking from the above function. The string is used as a key in a static NSMutableDictionary:
[dictionary setObject:instance forKey:name];
This dictionary is 开发者_如何学JAVAnever released during the course of the program. Is this a leak? This is a MacOS application.
The dictionary is defined statically:
static NSMutableDictionary *dictionary = nil;
Then later:
if(dictionary == nil){
dictionary = [NSMutableDictionary dictionaryWithCapacity:5];
[dictionary retain];
};
This function itself does not contain a memory leak. stringWithFormat
returns an autoreleased object and so are you. If there is a leak it must be somewhere else.
精彩评论