objective c - memory management: am i doing something wrong here? -


In my iPhone application a very small number of cases, I get an accident after the loop in the code given below Is:

  ABAddressBookRef AddressBookEnter = ABAddressBookCreate (); CFMutableArrayRef abContacts = (CFMutableArrayRef) ABAddressBookCopyArrayOfAllPeople (Address Bookinit); // All contacts get the array of CFArraySortValues ​​(abContacts, CFRangeMake (0, CFArrayGetCount (abContacts)), (CFComparatorFunction), ABPersonComparePeopleByName, (Zero *), ABPersonGetSortOrdering ()), NSArray * copypeople = (NSArray *) abContacts; NSMutableArray * tempTheadlist = [[NSMutableArray alloc] init]; For (; I & lt; i = 0 int copypeople.count; i ++) {NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; ABRecordRef record = [copyEople ObjectOutIndexX: i]; If (Blah Blah) [tempThreadList addObject: someObject]; [Bridge release]; } // End of accident after loop ends (tempTheadlist.count> 0) [NSThread detachNewThreadSelector: @selector (loading_pictures :) toTarget: auto withObject: tempTheadlist]; [TempTheadlist Release]; [Copy release]; CFRelease (addressBookInit);  

Is any reason why it should crash here at any point?

"text" itemprop = "text">

(1) ABAddressBookCopyArrayOfAllPeople () a CFArrayRef , Not a CFMutableArrayRef .

(2) CFArrayRef, CFMutableArrayRef, and NSArray inserted among all are irrelevant. NSArray and CFArray are synonymous.

(3) The autoreclip pool in the () loop is irrelevant. Any new objects can not be made in () loop, and thus nothing should come into the pool. Neither objectAtIndex: will maintain / autorer objects.

(4) That you are sorting the ARM returned by all people (AB) Address Archippi, possibly a crash may be triggered. This function is declared as returning CFArrayRef () and it will be considered irreversible.

If the app is crashing, then post the accidental backtrack. Without it, it is difficult to say how specially the accident is being triggered, is this crash in the thread which runs the code above? ... or crashing in a newly created thread?


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -