title: iOS - Memory leak AddressBook
body: <p>I was working around AddressBook framework when I've found out some memory leak of different types in my application :</p>
  
  <pre><code>Leaked Object   #   Address Size    Responsible Library Responsible Frame
  __NSCFArray 8   &lt; multiple &gt;    256 Bytes   AddressBook ABCMultiValueInsertAndCreateIdentifier
  __NSCFString    7   &lt; multiple &gt;    224 Bytes   AppSupport  _sqliteStatementApplyValuesFromRecordWithNullValue
  Malloc 32 Bytes 8   &lt; multiple &gt;    256 Bytes   AddressBook ABCMultiValueInsertAndCreateIdentifier
  __NSCFArray 8   &lt; multiple &gt;    256 Bytes   AddressBook ABCMultiValueInsertAndCreateIdentifier
  ABCMultiValue   8   &lt; multiple &gt;    256 Bytes   AddressBook ABCMultiValueCreate
  Malloc 32 Bytes 7   &lt; multiple &gt;    224 Bytes   AddressBook ABCMultiValueInsertAndCreateIdentifier
  __NSCFArray 7   &lt; multiple &gt;    224 Bytes   AddressBook ABCMultiValueInsertAndCreateIdentifier
  Malloc 32 Bytes 5   &lt; multiple &gt;    160 Bytes   AddressBook ABCMultiValueInsertAndCreateIdentifier
  </code></pre>
  
  <p>Here's my code :</p>
  
  <pre><code>- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
  
      SDAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
  
      ABMultiValueRef multiRef = ABRecordCopyValue(person, kABPersonPhoneProperty);
      NSString *number = (__bridge NSString *) ABMultiValueCopyValueAtIndex(multiRef, 0);
      NSString *firstname = (__bridge NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
      NSString *lastname = (__bridge NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
  
      number = (number ? number : @"");
      firstname = (firstname ? firstname : @"");
      lastname = (lastname ? lastname : @"");
  
      NSDictionary *dic = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:number, firstname, lastname, nil] forKeys:[NSArray arrayWithObjects:kSDPhoneNumberKey, kSDFirstnameKey, kSDLastnameKey, nil]];
  
      NSMutableArray *numberArray = [NSMutableArray arrayWithArray:appDelegate.contactArray];
      [numberArray addObject:dic];
  
      [appDelegate setContactArray:numberArray];
  
      [self.tableView reloadData];
  
      [self dismissModalViewControllerAnimated:YES];
  
      return NO;
  }
  </code></pre>
  
  <p>Do someone know which lines are responsible for these leaks ?</p>