
91
Chapter 4
Memory
M
soware correctness and perfor-
mance. In this chapter, we consider memory management within
a program. We begin with an overview of memory used for running
programs, dierentiating between program stack and heap memory. We
examine the task of copying data, when that data is stored in heap mem-
ory, noting dierences inherent in programming languages. We briey
discuss memory allocation and deallocation schemes, including explicit
deallocation, garbage collection, and reference counting.
Most importantly, we identify memory management details that impact
soware design. Although memory manipulation ...