Electron microscopy
 
Dynamic Allocation and Data Storage in Memory in C++
- Practical Electron Microscopy and Database -
- An Online Book -
Microanalysis | EM Book                                                                                   http://www.globalsino.com/EM/        


=================================================================================

 

There are two primary ways to store information in the main memory of the computer in C++ and DM programs:
          i) Through the use of variables. In this case, the storage provided by variables is fixed at compile time, and cannot be altered during the execution of a program.
          ii) Through the use of C++’s dynamic allocation system. In this method, storage for data is allocated as needed from the free memory area that lies between your program (and its permanent storage area) as well as the stack. Here, this region is called the heap.

Dynamically allocated storage is in fact obtained at run time. Therefore, dynamic allocation makes it possible for your program to create variables during its execution, and it can create as many or as few variables as required, depending upon the program situation. Memory to satisfy a dynamic allocation request is taken from the heap.

DM and C++ contains two operators, new and delete, that perform the functions of allocating and freeing memory.

 

 

 

 

=================================================================================