Why is
Stack : Stored in Computer RAM like heap and
Heap : Stored in Computer RAM like stack ?
according to the nice answer by “Brain R Bondy” here
I am using Java language. Also what if i have too less RAM.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Everything has to be stored in main memory (RAM) at some point, otherwise the CPU cannot work with it.
If you’re running out of RAM, the operating system will outsource some of your application’s memory to disk. This will make your program slow, but not break it. Because of this, the amount of memory your program can use does not depend on the amount of RAM that is physically available.
If you get stack overflow errors, you probably have an infinite recursion bug in your program.
If you get heap space/out of memory errors, see this question: What does Java option -Xmx stand for?