Question: Every computer system has a finite amount of memory ( this includes the various caches, the RAM, and virtual memory ) . The amount of

Every computer system has a finite amount of memory (this includes the various caches, the RAM, and virtual memory). The amount of memory may be large, but it is finite. When a program calls a subfunction, that subfunction may in turn call yet another subfunction, and so on and so on and so on. Each time the program counter of the caller is pushed onto a stack so the stack grows over time as more and more subfunctions are called. Inside each subfunction, local variables can be created by allocating memory from the "heap". When a subfunction returns control to it's calling function, the portion of the heap the subfunction used is returned for use by other subfunctions.
If the stack grows without bound, and each subfunction attempts to create some local variables, what could happen?
Looking for a thoughtful answer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!