Memory Errors

The arguments for and against the use of garbage collection pit efficiency against correctness. A GC system necessarily imposes a penalty in execution time, on the other hand it can significantly reduce programming errors. Language designers fall on both sides of this argument.

Among the errors that a garbage collection system can help avoid are the following. Most obviously running out of memory because the programmer forgot to free values. But another error is using a memory value after it has been recovered (that is, after the programmer has indicated it can be deleted). A third type of error is attempting to free the same value twice. In systems that lack garbage collection systems any of these can lead to difficult to detect errors.

[audio] [real] Text to accompany slide09, in Chapter 5 of An Introduction to Object-Oriented Programming