The heap
The heap
It is possible to have completely dynamic data structures without placing them inside an array, although it is often convenient to use an array if it is the processing on the data that is important and an idea of the amount of data that will be processed is predictable. To use a data structure completely dynamically requires the structure to use an area of memory known as the heap. This is an area in RAM that has been reserved for processes that don’t quite know how much RAM they will need during their processing, as is the case with truly dynamic data structures. The heap is available for any process to use. It is a lot quicker for a process to access some RAM from the heap than it is for it to ask the operating system for some RAM each time it needs some.
If a process needs a block of RAM from the heap then it will request a heap block. When a structure has finished with some heap blocks, they can be returned to the heap, ready for use by another process.
