memory management - Ownership of members inside NSArray? without ARC -
memory management - Ownership of members inside NSArray? without ARC -
is there memory leak without arc?
nsmutablearray *array = [[nsmutablearray alloc] init]; nsnumber *numberfortest = [[nsnumber alloc] initwithint:123456]; [array addobject: numberfortest]; [numberfortest release]; nslog(@"number = %@", numberfortest); //safe access "numberfortest" after calling release??? [array release];
my concern is: did
[array addobject: numberfortest];
make "numberfortest" not qualified deallocated, before
[array release];
??? after using static analyzer, no leak reported. , output consistently correct. don't sense comfortable.
nsarray (and nsmutablearray) retain objects.
when release array, all objects in array released well.
memory-management memory-leaks xcode5 nsarray automatic-ref-counting
Comments
Post a Comment