PDA

View Full Version : CF and Retain?




MorphingDragon
Aug 15, 2009, 10:34 PM
Is it really so important to learn these functions? I mean, I have a limit which I need to get a (Highly Paid) project done and I do not need or intention to develop for Tiger. What is CF actually used for and Garbage Collector is a lot simpler than Retain.



Guiyon
Aug 15, 2009, 11:19 PM
If you are using CoreFoundation, there is garbage collection but you still need to use the CFRetain/CFRelease pairings as the garbage collector will not collect anything with a non-zero retain count and there are a few gotchas as to when the object is actually deallocated. I'd suggest reading through the below material as it details the Cocoa/CoreFoundation memory management schemes.

If you are using Objective-C with Cocoa/Foundation, read these:
Garbage Collection Programming Guide (http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Introduction.html)
Memory Management Programming Guide for Cocoa (http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html)

If you are using C and CoreFoundation (as I see you referenced a CF- prefix):
Memory Management Programming Guide for Core Foundation (http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/CFMemoryMgmt.html)