I have a method as follows. I want to know if the returned dictionary is autoreleased or not.
- (NSDictionary *)someMethod {
NSMutableDictionary *myDict = [[NSMutableDictionary alloc] init]; //did not autorelease it here
//-------------------------------
//Some code
//-------------------------------
return (NSDictionary *) myDict;
}
Note: I haven’t added autorelease while initializing the object on purpose.
myDict would not be autoreleased. Would be retained. Replace the return line for
Otherwise you are most likely introducing a leak.