Hacker News new | ask | show | jobs
by klodolph 5250 days ago
You're saying you have a different definition of "garbage collection", that's fine. Reference counting is listed as one of the three classical garbage collection algorithms on page 19 of "Garbage Collection" by Richard Jones and Rafael Lins. In the preface they define garbage collection as "the automatic reclamation of heap-allocated storage after its last use by a program."

It is irrelevant to cite situations under which an algorithm will fail to reclaim storage as evidence that an algorithm is "not garbage collection", since it is provable that situations exist for every possible algorithm. I can write a program that creates an infinite linked list but only ever uses the head, most GCs would fail to reclaim the tail of the list even though it is garbage.

This is not a theoretical concern, space leaks are possible under any automatic storage reclamation scheme.

Since in practice you can write applications for Android and iOS with languages and runtimes of your choice...

1 comments

Kinda splitting hairs. Even though it's automatic, it's not called garbage collectio, and its handled quite differently in iOS 5 than in languages such as Java. iOS releases memory the instant its reference counter gets to 0 - not seconds or minutes later.

As you must know, the very name Garbage Collection implies an asynchronous process that travels up and down the program memory street at periodic intervals, trying to find garbage to collect.

The iOS model is more like a waiter in an expensive restaurant who comes and takes your plate away the instant the last morsel of food is in your mouth. You don't have to discard the plate yourself, but you can guarantee he will pick up your plate the moment its free to be picked up.