If this is an asynchronous call, it makes sense to create NSMutableArrayinside the actual block:
[self performOperationWithBlock:^(void)
{
NSMutableArray *objArray = [[NSMutableArray alloc] initWithCapacity:0];
.
.
}];
As you will not need this after the block (this only makes sense during the async operation), so at the end release it after you have used it. Or you can simply:
NSMutableArray *objArray = [NSMutableArray array];
And in this case, you do not need to release it.
If it is a synchronization call, you should releaseafter the block.
Note. . I assume that you fill NSMutableArraybefore using it in the block, which means that it makes sense to create it before the block starts.
:
-(void) doSomething
{
NSMutableArray *objArray =
[self performOperationWithBlock:^(void)
{
}];
}
:
, , , , , , :
-(void) doSomething
{
__block NSMutableArray *objArray =
[self performOperationWithBlock:^(void)
{
}];
[objArray release];
}