Computer Memory:
DOS operating range. (Reaches above 640
for storage purposes. |
|
|
Visual
C++
|
C++ Programs |
data
STACK
run time stack |
|
Extended memory
|
High memory
|
|
HEAP
- the available memory after everything running gets what it needs.
It is constantly being eroded by the operating system. It is memory to be used and returned when done.
The goal of heap memory is to use only what the user needs. Heap can be accessed ONLY by pointers.
There are no variable names in the heap. Consequently, we need an understanding of pointers.
local variables - memory is on the STACK. (You cannot control the size of the
stack in anyway.) A local variable's value disappears once its block ends, but the memory reserved for that variable does not
automatically become available to other tasks in the same way that
heap memory becomes available.
Memory Vocabulary:
allocate
- request memory from the heap.
available heap
- amount of memory on the heap at any one time.
deallocate - releasing heap memory from your program's use and returning the
memory to the available heap.
dynamic memory allocation
- the process of allocating and de-allocating heap memory from within a program.
free - same as de-allocate.
free heap - same as available heap.
free store - same as available heap.
heap management - making sure that you utilize the heap properly, checking for errors when you allocate, and freeing heap memory that you no longer need.
unallocated heap - same as available heap.
|