Linked by Zachary Pinter on Tue 27th Apr 2004 17:09 UTC
General Development Garbage collection (GC) is a technology that frees programmers from the hassle of explicitly managing memory allocation for every object they create. Traditionally, the benefit of this automation has come at the cost of significant overhead. However, more efficient algorithms and techniques, coupled with the increased computational power of computers have made the overhead negligible for all but the most extreme situations.
Permalink for comment
To read all comments associated with this story, please click here.
RE: Conclusion
by edwardr on Tue 27th Apr 2004 20:23 UTC

> Conclusion
>
> Although garbage collection can never be as efficient in
> every way as a well-programmed “micro-managed memory”
> application, ...

Actually, this is not true. A "micro-managed menory" app that allocates 100,000 small items and then frees all but 5 of them takes a small constant C * 100000 to allocate and another (C * 100000) to free. However, a copying GC allocates by simple pointer advancing (b/c it's got a completely empty heap) 100,000 items is a smaller constant c * 100000, and then determines that there are 5 live objects, takes some larger constant K * 5, and then frees the other 99,995 in ONE INSTRUCTION!

In short, "micro-managed" memory allocates and frees related to the number of items allocate and freed, and the copying GC allocates related to the number of items allocate, but frees related to the number of items left alive.

So in some cases, copying GC can be faster. But even if this is the case, usually GC'd languages are slower for other reasons, too, not just GC (like being interpreted, etc.)