Why is Garbage Collection A Good Thing?
From: Paul Johnson (paj@gec-mrc.co.uk) Garbage collection (GC) is a facility in the run-time system associated with a language which will automatically reclaim objects which are no longer used. OO Languages which require garbage collection include Eiffel, Smalltalk and CLOS. C and C++ can have garbage collection retrofitted (see [3] and [4] below). [Ada has switchable GC, too -bob] Without GC programmers must explicitly deallocate dynamic storage when it is no longer needed (in C this is done by a call to free(3)). There are a number of problems with this: 1: Bugs due to errors in storage deallocation are very hard to find, although products are available which can help. 2: In some circumstances the decision about whether to deallocate storage cannot be made by the programmer. Drawing editors and interpreters often suffer from this. The usual result is that the programmer has to write an application-specific garbage collector. 3: An object which is responsible for deallocating storage