+ 6
Heap vs stack
In my university I learnt that when a programme is been executing the RAM will have many sections or parts two of them are stack and heap Is there any variation between them ? is stack faster than heap regarding any address in ram can be reached in the same time
2 Respostas
+ 4
The stack is faster because the data is contiguous. The heap is slower because data has to be accessed at somewhat random locations. In addition to that, the program has to request and free the memory from the operating system which takes time.
+ 3
Thanks Division by Zero you sold me