+ 1
The heap: Unused program memory that can be used when the program runs to dynamically allocate the memory.
can any one explain this?
2 Réponses
+ 4
The heap segment (also known as the “free store”) keeps track of memory used for dynamic memory allocation.
In C++, when you use the new operator to allocate memory, this memory is allocated in the application’s heap segment.
The address of this memory is passed back by operator new, and can then be stored in a pointer. You do not have to worry about the mechanics behind the process of how free memory is located and allocated to the user.
However, it is worth knowing that sequential memory requests may not result in sequential memory addresses being allocated!
http://www.learncpp.com/cpp-tutorial/79-the-stack-and-the-heap/
+ 2
Heap memory is simply the memory that is left over after the program was loaded and the Stack memory was allocated. It may (or may not) include global variable space (it's a matter of convention).
from:
https://stackoverflow.com/questions/5836309/stack-memory-vs-heap-memory