+ 1
What is stack memory and heap memory?
What is stack memory and heap memory? Why are they both used? What new is for?
2 Answers
0
stack:
it is for functions. each function will be loaded in stack.
Heap:
it is for variables in each function. all the variables for that particular function will be loaded in heap.
when your recursive function does maximum calls for self, you'll get a stack overflow.
when your function uses a lot of variables and when they try to store the values but no space, you'll get out of memory error.
0
owh great, thanks @nagendraprajawal