Memory Allocation - Stack and Heap Based

Before we discuss the impact of object-orientation on memory management, let me remind you a little bit about how memory management is generally performed in computer langauge.

Generally speaking, memory is divided into stack based and heap based allocation.

Stack based memory is tied to procedure entry and exit, and furthermore the amount of memory required for a variable must be known at compile time. However, stack based memory can be performed very quickly.

Heap based memory is not tied to procedure entry and exit, however the management of heap-based memory is more complicated than stack-based memory. Generally, recovery of heap-based memory must be either handedled explicitly by the programmer, or by a run-time library, called the garbage colleciton system. It is generally considered that heap-based memory is somewhat less efficient than stack-based memory.

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