Hacker Newsnew | comments | show | ask | jobs | submitlogin
nikster 561 days ago | link | parent

I can't help but think that ARC has pretty much killed garbage collection. Why use garbage collection at all when you have a static equivalent that works just as well?


rayiner 561 days ago | link

ARC doesn't work just as well. At least theoretically, ARC retains a lot more garbage because the compiler has to be much more conservative about reachability than the garbage collector. ARC has theoretical failure modes that can cause huge amounts of retained garbage, and that's less well-understood than the failure modes of GC. Doing reference count updates is also generally slower in terms of CPU cycles than doing garbage collections. Oh, and ARC doesn't handle cycles.

That said, I think reference counting warrants more attention than it has gotten in memory management research. If you're willing to punt on the leaking cycles issue, you can get a lot of mileage out of using a reference counting collector as a tenured generation with a copying nursery.

-----

stcredzero 561 days ago | link

> you can get a lot of mileage out of using a reference counting collector as a tenured generation with a copying nursery.

Are there implementations one can play with?

-----

rayiner 560 days ago | link

I think MMtk might have an implementation of the technique. There are some papers on it: http://www.cs.technion.ac.il/~erez/Papers/AzatchiPetrankCCPE...

-----

aaronbrethorst 561 days ago | link

ARC has absolutely killed garbage collection.

    Important: Garbage collection is deprecated in OS X v10.8. You should use ARC
    instead—see Transitioning to ARC Release Notes.
https://developer.apple.com/library/mac/#documentation/Cocoa...

Whether ARC is better or worse than GC overall is immaterial. Apple has moved away from garbage collected Objective C.

-----

jonknee 561 days ago | link

> ARC has absolutely killed garbage collection

... In Apple's Sandbox. Apple has also killed ethernet and other very not-dead in the real world things.

-----

i386 561 days ago | link

Killed ethernet? Thats a somewhat ill-informed statement to make. The latest iMac still has an ethernet port.

They did remove it from their line of portables as most people use wireless with their laptops (and they scored some valuable real-estate on the main board!) but you can get a Thunderbolt network card if you really want to be tethered to your desk.

-----

jonknee 561 days ago | link

Ah, the iMac that you still can't buy (end of the year is a really strange time to have no inventory of your new flagship desktop)... But that's another rant.

Apple's computers (desktops included, save for the Mac Pro which is essentially EOL) no longer have an optical drive, maybe I should have used that instead. I saw a coworker hunting for his MacBook's ethernet port today, so it was was fresh in my mind.

-----

jcromartie 560 days ago | link

I honestly can't remember the last time I used an optical drive (and I have one in my MBP). Alternatives are superior in virtually every way.

-----

jonknee 560 days ago | link

If you have an always on, reasonably fast and unmetered broadband connection perhaps. I understand it on the laptops, but desktops have plenty of available space so they're removing them simply for the sake of removing them.

I don't use the optical drive on my iMac much, but the times I have had to were not times I would have been able to avoid. I don't want yet another accessory/dongle or one less USB port. There's tons of room, just include the drive.

This came up recently with trying to install Windows inside Parallels on my girlfriend's laptop. Their IT people had a DVD and of course her laptop has no DVD drive, so I looked up how to use Remote Disc and found out that it works great except explicitly not for installing an OS and oddly almost all the other common uses of an optical disc.

http://support.apple.com/kb/HT5287

These types of discs are not supported by DVD or CD sharing: These types of discs are not supported by DVD or CD sharing: DVD movies, Audio CDs, Copy protected discs such as game discs, Install discs for an operating system such as Microsoft Windows (for use with Boot Camp), or Mac OS X.

-----

gurkendoktor 561 days ago | link

If Apple does not take care that its frameworks behave well with a GC app, you are likely in for a masochistic rollercoaster ride.

Apple also hasn't killed Ethernet, the desktops still have it.

-----

mpweiher 560 days ago | link

It's easy to get into a world of hurt even when Apple does its best to make their frameworks well-behaved with GC.

Retrofitting a conservative GC onto C is really hard, and they were never able to fully make it work. If you look at the Boehm collector's page, you see a lot of potential issues that can and do arise. Having these issues in an optional add-on that you adopt (or not) after weighing the issues is one thing, having them in a system-component that is declared to (a) be the future and (b) "Just Work™" is another.

http://www.hpl.hp.com/personal/Hans_Boehm/gc/issues.html

-----

bronxbomber92 561 days ago | link

I think he meant more generally. ARC, as a general algorithm, has killed the need for garbage collection, as a general algorithm [I]anywhere[/I]. As supposed to what you're saying: ARC, Apple's implementation of ARC, has persuaded Apple to abandon their GC implementation. These are two very different meanings (but yes, in Apple's case ARC has killed GC because of particular characteristics and needs of Apple's developer toolchain and environment).

-----

mikeash 561 days ago | link

It doesn't work nearly as well. ARC doesn't handle cycles at all, which makes it substantially more painful to use than a garbage collector. Don't get me wrong. ARC is great compared to the previous situation, but it's simply not a substitute for a real GC.

Automatic reference counting dates back to probably the 1950s. If it "works just as well" as garbage collection, don't you think it would have won by now?

-----

seanmcdirmid 561 days ago | link

One day a student came to Moon and said, "I understand how to make a better garbage collector. We must keep a reference count of the pointers to each cons." Moon patiently told the student the following story - "One day a student came to Moon and said, "I understand how to make a better garbage collector...

http://www.csd.uwo.ca/staff/magi/personal/humour/Computer_Fo...

-----

mikeash 561 days ago | link

This makes me paranoid that you can read my thoughts.

-----

seanmcdirmid 561 days ago | link

Why? The garbage collection koan is common knowledge among compiler and PL people, I just took some initiative.

-----

mikeash 561 days ago | link

It's a joking way to indicate that this is exactly what I was thinking of when I wrote my comment.

-----

krichman 561 days ago | link

ARC is terrible, I've had far more errors with it than I ever did without.

-----

Apocryphon 561 days ago | link

Do tell, please.

-----

jcromartie 560 days ago | link

Curious... I've never had a problem with it.

-----

darknoon 560 days ago | link

rdar? I'm calling BS on this.

-----

ynniv 561 days ago | link

Besides memory fragmentation?

-----




Guidelines | FAQ | Lists | Bookmarklet | DMCA | News News | Bugs and Feature Requests | Y Combinator | Apply | Library | Contact

Search: