views:

42

answers:

1

What is the difference between Garbage Collection and Reference Counting in Mac OS X.

Thanks and regards. Mahadevan S

+2  A: 

When using garbage collection you don't have to worry about releasing the memory that you allocate. The garbage collector will do that for you.

You can read more in the Garbage Collection Programming Guide.

Usually you have to tell the compiler with a flag if you want to have garbage collection enabled.

Garbage collection is available on Mac OS X, but not on iOS.

When not using garbage collection, but reference counting, you must follow the Memory Management Programming Guide and make sure that you release all the objects that you own.

Florin