Because you had to assign a property, not an instance variable. When you assign a property, it will save the variable again, and then you will not have a problem. Here is what your code should look like:
NSMutableArray* s = [[NSMutableArray alloc] init]; self.stack = s; [s release];
Thus, you do not assign this variable, but use a property (this is, in fact, a method). If you did not release in this case, then you will have a memory leak in your code.
When you did stack = s , you assigned directly to the instance variable, and the array was never saved.
MaurΓcio Linhares
source share