Memory Recovery

Because the new operator is activated at run-time, it means that memory is allocated during the course of execution. We call this process dynamic memory allocation. On the flip side, it means there must be a process or recovering the memory associated with no longer useful objects, since otherwise long running programs could quickly run out of memory. There are two broad approces to this task. In some languages the programmer must explicitly say when a value is no longer being used. In C++, for example, the programmer uses the statement deleted, while in Object Pascal the statement is named free.

The other approach is to use what is known as a garbage collection system. A garbage collection system monitors memory use, and will automatically determine when a value is no longer being used, and hence can be recovered.

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