I try always to understand the things how it works, instead of understanding the syntax of the language, I didn’t understand the difference between the heap and the stack , and where are they , I now the Ram the Cache … maybe because I am a French native speaker , but any explanation will be welcome
To an Objective-C programming, the stack is where local (or automatic) variables are stored. The heap is where objects live.
Thank you for your answer it makes sens now , and both of them physically in RAM ?
That’s actually a surprisingly deep question.
As far as you need to know for the next two years, the answer is “Yes.”
(The true answer is “probably”)
Here is a good source for understanding memory, the Stack and the Heap:
Thank you for that link Kotaro! That helped me tons!
Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer’s RAM .
Variables allocated on the stack are stored directly to the memory and access to this memory is very fast, and it’s allocation is dealt with when the program is compiled.
Variables allocated on the heap have their memory allocated at run time and accessing this memory is a bit slower, but the heap size is only limited by the size of virtual memory .
More…Stack and Heap