0
I didn't undrstand when the virable delet from stack ram
2 Antworten
0
Stack vs heap
Stack is where the program uses to allocate required memory (from the system RAM) to its variables, constants, and other non-dynamic containers. The life time of the program's stack would end by terminating the program becase it belongs to that program.
Heap, on the other hand is a free block of memory where the program use it to dynamically allocate storage to dynamic types which their size and state will be determined at runtime. In this case, the programmer is responsible for memory managment*. The common problem in this stage is memory leakage. When the leakage occured, neither program nor OS can do anything about that until the next system restart.
-----
* those containers which claim the memory by new keyword.
0
thank you