PDA

View Full Version : Do I need to Start the Garbage Collector?




BadWolf13
Sep 16, 2010, 11:04 AM
Running through the Core Data Utility Tutorial, and it says that I need to turn on garbage collection in the build settings, and add the function call

objc_startCollectorThread();

in order to "start the garbage collector." Now in all the applications I've written so far, I turned on the garbage collector in the build settings, but I never heard of this function call before. Does that mean that the garbage collector wasn't working in my previous apps, or is this requirement just for command line tools?



lee1210
Sep 16, 2010, 11:17 AM
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcEssentials.html

See the "Foundation Tools" section.

-Lee

Catfish_Man
Sep 16, 2010, 11:25 AM
NSApplicationMain() calls it for you in AppKit apps. You only need to do it for commandline tools and such.