0
Memory organisation
How is memory organised when programming c++? what is dynamic and static memory? Where is it saved?
10 Respostas
+ 14
I like this question, Memory in C++ is organized into 3 categories. The stack, the heap and the text. The stack is used to push functions on top of each other creating scopes, but it also is a small memory reserve for those functions. Local variables use this memory. The heap is a place where uninitialized variables get there memory. Anytime you use the "new" keyword or make a call to a memory function in cstdlib, you are getting memory from the heap. The text is literally just text, this is the part of the program that holds your declarations, and all the text of your program. The stack is considered static memory, because it is set, and doesn't change. And the heap would be dynamic memory because it is always changing. All the memory is loaded into either the RAM of your computer or one of the three caches of your computer.
+ 9
Globals, which I assume is what you're referring to, are like locals. When the program starts anything it finds globally are automatically pushed to the stack and will stay there until the program ends.
+ 8
LMAO, I'm 19 brođđ
+ 8
@Ivan, precisely
+ 8
@SoraKatadzyma that's ......a bit...... too intense =,=.
+ 7
@soraKatadzuma
how can u answer soo... intense.... just being 10....
OMG
+ 7
me too....
+ 2
So if i create an instance of a class without the new-operator, it will be put into stack?
+ 1
where are the variables stored that aren't created with new and aren't local variables in functions?
0
are these objects also accessed by the stack-pointer?