A good answer might be:

232 — about four billion

Review of Memory

Recall (from chapter 10) that there are 232 bytes available, each one with its own address. Most of these bytes are virtual. They are implemented by the virtual memory system and do not directly correspond to bytes in RAM chips. But in appearance they are there.

On a multitasking system there may be many programs running. But the system makes it look to each program as if 231 bytes are there for it alone. The other half of memory is for the operating system. For these chapters ignore the implementation details and just think of a program as running by itself in two billion bytes and operating system running in the other two billion bytes.

The picture shows a program running in the bottom half of memory in addresses and the operating system in the top half. To see that the address 0x7FFFFFFF divides the address space in two, take the maximum address 0xFFFFFFFF and divide it in two by shifting right one place.

The operating system divides the memory available to a program into sections. This is not required by hardware, but makes managing computer operations easier. The Text Segment holds the machine language of the program. The Data Segment holds the memory that has been allocated to the program just as it starts. The Stack Segment is for the run-time stack.

Between the data segment and the stack segment there is unallocated memory that is used for growing the stack (shown as the top downward-pointing arrow) or for creating dynamic data structures (shown as the top downward-pointing arrow). Both of these activities occur as the program is running.

The portion of memory above the data segment that has been allocated to data structures is called the heap.



QUESTION 2:

What is the process of allocating memory from the heap called?