What happens when the unused memory space between stack and heap in a process’s virtual memory is exhausted ?
Share
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.
In Windows there is a guard page between the stack and the heap and so the heap and the stack never touch. This is for security reasons (so that a stack exhaustion bug cannot lead to a more exploitable heap-overflow bug).
If you’re asking what happens when the heap gets full, the simple answer is that your malloc (or HeapAlloc or whatever) calls will start returning NULL. If you’re asking what happens when the stack gets full, well, you get a stack-exhaustion exception (sometimes wrongly called a stack-overflow). In either case this usually causes the program to free up some memory and continue or exit to the desktop.