PDA

View Full Version : Garbage - to collect or not to collect?




CaptSaltyJack
Jul 23, 2008, 01:42 PM
I'm just curious, and decided to run a poll on how many developers turn on garbage collection in Xcode, and how many leave it off.

Vote please, and also feel free to discuss the pros/cons, and if it makes life much easier for you or not, and any noticeable impact you've seen on your apps.



laprej
Jul 23, 2008, 02:00 PM
I do use GC and feel it allowed me to prototype something (non-professional) quickly. I had to write a discrete event simulator in Objective-C, pass network packets back and forth between wireless nodes, use NSInvocations for delayed messages, etc. If I had to maintain proper retain counts along the way, I feel my time to develop this software would have doubled or more. My time is better spent ensuring proper protocol behavior than chasing down places where I should/should not have retained.

foidulus
Jul 23, 2008, 02:09 PM
You still pretty much have to unless you are developing Leopard only apps. GC isn't supported on Tiger or iPhone, so nice to get into the retain release habit.

ManWithhat
Jul 23, 2008, 04:10 PM
It's more efficient to manually garbage collect, which is one of the reasons C++ is faster than C#/Java (Java has its own issues). Anyways, it's a good habit to get into and generally not that difficult to do if you're following a proper Object-Oriented programming style.

Catfish_Man
Jul 23, 2008, 09:39 PM
I wish I could turn it on, but I can't. Converting a >250,000 line application built pre-GC and with tons of crosstalk with various cross platform C libraries to use GC? Not fun. Maybe not even possible to do without breaking tons of stuff.

Alloye
Jul 24, 2008, 05:18 AM
I'm using it for new code but probably won't bother to go back and convert some of my old stuff.

Mac Player
Jul 24, 2008, 08:08 AM
NEVAH!!!!! It's so easy to manage memory in Objective-C why should i waste cycles with a GC that has so many twists?

LtRammstein
Jul 24, 2008, 12:52 PM
I believe it depends on what the code's purpose is for.

I personally believe manually handling it is better. It allows you to think outside the box when it comes to problems that you run into during compile/writing.

Garbage Collection is nice, but I feel if we leave basic memory management knowledge to be automated, we'll be under mountains of pointers pointing to nothing.