Garbage - to collect or not to collect?

Discussion in 'Mac Programming' started by CaptSaltyJack, Jul 23, 2008.

?

Do you use garbage collection?

  1. Yes I do (either in "supported" or "required" mode)

    4 vote(s)
    28.6%
  2. No I don't, I do manual retains/releases/autoreleases

    10 vote(s)
    71.4%
  1. CaptSaltyJack macrumors 6502

    Joined:
    Jun 28, 2007
    #1
    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.
     
  2. laprej macrumors regular

    Joined:
    Oct 14, 2005
    Location:
    Troy, NY
    #2
    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.
     
  3. foidulus macrumors 6502a

    Joined:
    Jan 15, 2007
    #3
    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.
     
  4. ManWithhat macrumors regular

    Joined:
    Jun 24, 2008
    #4
    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.
     
  5. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #5
    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.
     
  6. Alloye macrumors 6502a

    Joined:
    Apr 11, 2007
    Location:
    Rocklin, CA
    #6
    I'm using it for new code but probably won't bother to go back and convert some of my old stuff.
     
  7. Mac Player macrumors regular

    Joined:
    Jan 19, 2006
    #7
    NEVAH!!!!! It's so easy to manage memory in Objective-C why should i waste cycles with a GC that has so many twists?
     
  8. LtRammstein macrumors 6502a

    LtRammstein

    Joined:
    Jun 20, 2006
    Location:
    Denver, CO
    #8
    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.
     

Share This Page