
347
Appendix B: Heap
Memory and Aliases
T
in C++, C#, and Java.
We contrast stack and heap allocation as well as explicit and implicit
deallocation. We examine class design responsibilities when heap memory
isallocated internal to an object. is appendix augments material presented
in Chapters 4 and 5. Readers are not expected to have experience with either
Cor C++, but those without such exposure should rst read Appendix A.
B.1 HEAP VERSUS STACK ALLOCATION
Chapter 4 provided an overview of a program memory, distinguishing
between the runtime stack and the heap. e runtime stack is used to hold
data ...