0
Stack and heap
So from what I understand, is that c++ memory is divided in to 2 parts stack and the heap, and these both are just a 2 diferance memory locations on your computers ram. So now my questions are: #1 how large is the stack and the the heap? #2 do stack and the heap memory locations apply to all programing languages? #3 when is the memory transfered from ram to cpu cashe?
1 Respuesta
+ 2
1: Your Operating system will decide of the size of your stack and heap
2: Most High level programming languages will not let you decide if the variables are allocated on the heap or the stack.
3: All the time, compared to cache access, RAM access is really slow. Thus, the CPU will try to move the code you use the most in cache, so it can be faster. However, the cache size is pretty small and so your code has to be designed in a way that when a part of your code is executed it does not try to access memory from everywhere because it will then be impossible for the CPU to keep everything in cache.