Questions about the AddressBook APIs...
Questions about the AddressBook APIs...
- Subject: Questions about the AddressBook APIs...
- From: email@hidden
- Date: Wed, 13 Dec 2006 11:52:29 -0600
So I recently wrote a simple foundation tool to remove overlapping contacts
defined by having the same email address b/w two different groups in
AddressBook. I make use of "sender member of group" in Mail.app's rules so
these groups have about 2000+ contacts each. Each contact is unique and all it
consists of it an email address. What I didn't understand what my program was
initially written to load the contents of all Persons from each group and then
use a nested loop to compare each email address for each contact. I observed
that memory simply grew and grew and grew. and this growing seemed to occur
when using an NSEnumerator to iterate of the NSArray comprising of a set of
Persons from each group.
Last night I rewrote the app to use separate autorelease pools such that I
initially loaded each set and then build an id->email address dictionary and
then threw away the NSArray of Persons for each group and then used
recordForUnqiueId when ever I had a match to load the ABPerson for the
overlapping contact and this seemed to be dramatically different in terms of
memory usage.
Q1. Why is it necessary to load a full Person when they have unique ids just to
delete it? see. ABAddressBook remove:
Q2. Why would iterating over each group in a nested fashion completely grow the
memory to in excess of 1gig? Note the final solution iterates over the
dictionary so the same about of enumeration still applies.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden