Does ABAddressBookCopyArrayOfAllPeople returns an autorelease'd object?
I was reviewing a code piece (see below) & I want your feedback over memory leak(s) over this statement. Can you pls explain this statement?
peopleArray doesn't release have any release/autorelease call after this statement.
Thanks.
I'm pretty sure that peopleArray (a mutableCopy) needs to be released explicitly before the enclosing block ends. Currently it has a memory leak due to the absence of [peopleArray release] statement.
As far as inner array is concerned, I believe its right to release (or autorelease) it since that function ABAddressBookCopyArrayOfAllPeople doesn't return an autorelease'd array.
Pls let me know if anyone disagree or has different view point.
I was reviewing a code piece (see below) & I want your feedback over memory leak(s) over this statement. Can you pls explain this statement?
Code:
NSMutableArray *peopleArray = [[(NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook) autorelease] mutableCopy];
peopleArray doesn't release have any release/autorelease call after this statement.
Thanks.
I'm pretty sure that peopleArray (a mutableCopy) needs to be released explicitly before the enclosing block ends. Currently it has a memory leak due to the absence of [peopleArray release] statement.
As far as inner array is concerned, I believe its right to release (or autorelease) it since that function ABAddressBookCopyArrayOfAllPeople doesn't return an autorelease'd array.
Pls let me know if anyone disagree or has different view point.
Last edited by a moderator: