Is there are way to test for mem leaks in OSX btw?
Oh yes! :-)
(... note the sound of Brucey rubbing his hands together as he gets comfortable...)
The following assumes you are using 10.5.x. (lesser versions are similar, but not so full featured)
Righty... in Finder, go to your Developer folder. (on mine, you open the main Disk, and you should see the Developer folder there).
Then into Applications.
There you will find an application called "Instruments". However these are not of the musical variety :-p
Open Instruments, and you should have a launch window which offers you tools such as Activity Monitor, File Activity, and of most interest, Object Allocations and Leaks.
Kick off Leaks, and your instrument panel should change to show two empty graphs of Leaks and Object Allocations.
Click on the Launch Executable combo, and find the app you want to execute.
You should now see the app appear in that combobox.
When you are ready, hit the red Record button.
Your app will start and all objects will be monitored.
You can use your app while this is monitoring and at any time, Pause recording, and examine the status of all live and deallocated objects.
The graph will indicate if something is leaking - if levels off after a while, all is well (obviously ;-)
I used this system to track and plug all the Mac MaxGUI leaks.
It's an excellent tool.