//.h file @property(nonatomic, retain) NSMutableDictionary *data; //.m file NSMutableDictionary *temp = [[NSMutableDictionary alloc] init]; self.data = temp; [temp
The second way leaks the newly-created dictionary. You could use:
self.data = [NSMutableDictionary dictionary];
And it would be as safe as your first example.
Edited to match OP's update to the question.