Memory: The Heap

Abstract

In any complex system—whether engineered or natural—products are constructed, distributed, used, and finally recycled. The lifetimes of such products are typically independent of the manufacturing process. Data structures are the primary (intermediate) products of complex programs, and data structures require memory. However, the memory that we have used so far—the stack—is not well suited for creating data structures whose existence is independent of functions’ execution periods. Stack frames form the stack, and the lifetimes of stack frames, by definition, correspond to function execution periods: a frame is pushed on the stack at the beginning of a function’s execution and popped from the stack at the end of the function’s execution; any data structure that resides in the stack frame is then lost.

This chapter introduces a sector of program memory, called the heap, specifically intended for producing data structures whose lifetimes are independent of the execution periods of the functions that create and manipulate them. Dynamic memory allocation is the process of obtaining segments of memory from the heap for use.

Keywords

Application Programming Interface Unit Test Memory Leak Execution Period Dynamic Memory Allocation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  1. 1.Dept. of Electrical, Computer, and Energy EngineeringUniversity of ColoradoBoulderUSA

Personalised recommendations