I am confused about the proper means of allocating memory in Objective-C. Suppose I have an NSMutableDictionary. There are two ways I can initialize it:
NSMutableDictionary *alpha = [[NSMutableDictionary alloc] init];
or
NSMutableDictionary *alpha = [NSMutableDictionary dictionary];
What is the difference between them? I know the first allocates memory for alpha, but what about the second?
Which of these is recommended as the best practice for allocating memory?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…