I don’t have an official bug report for this but I’m seeing a very ugly bug in Mac OS X Address Book or some part of the applications that work with its data. In short, it seems that in some situations Address Book can duplicate all the images associated with contacts, multiple times.

I keep really important data in my Address Book and as a result I do a weekly manual backup in addition to Time Machine backups. Look at the size of my weekly backups in this screenshot.

File listing of 6 Address Book backup files dated October 2 through November 8 2009, showing sizes growing from 16.4 MB to 120.3 MB.

In a two-week period the duplication happened multiple times. From October 24 to October 30 it happened twice increasing the size of all images from 17 to 34MB and then again from 34 to 64MB. It happened again doubling from 64M to 120MB! The culprit here are the images associated with contacts and stored in ~/Library/Application Support/AddressBook/Images. This behavior is on my Mac Pro which is synchronized with MobileMe to my MacBook Pro and iPhone. However, the error isn’t the same on all synchronized Macs. Looking in the images directory on my Mac Pro there is 130.5MB of data with 8,782 files.

Mac OS X Get Info panel for an Images folder showing 130.5 MB on disk with 8782 items in AddressBook application support

The same folder on my MacBook Pro is much smaller at 17.9MB with 1,222 items, however even that is too many.

Mac OS X Finder Get Info panel showing the AddressBook Images folder, 17.9 MB, 1,222 items, modified November 6 2009.

To put this into context my address book has 979 cards in it and I tend to associate an image with most entries. Sadly when I look at the images directory manually even the one on my MacBook Pro has duplicated once.

It is very hard to figure out what is going on that directory since the file names are all just random GUIDs. The best way I’ve found is to sort by file size which usually puts the duplicate files right next to each other. It seems likely that these extra files are just ignored, but they are taking up a lot of space and I worry will lead to eventual corruption.

If you use MobileMe I’ve found a way to fix this. Do a Reset Sync data and choose to replace your content on your computer with the data from MobileMe. After doing that my images directory is healthy at 11.9MB with 757 items in it.

Mac OS X Get Info panel showing the AddressBook Images folder is 11.9 MB on disk containing 757 items, modified today at 11:05 AM.

Strange and concerning behavior. Does anyone else see this behavior?