Does Heap Memory allow you to allocate a greater chunk of memory than Stack? If so then why is it?
Yes, heap allows one to allocate greater chunk of memory than stack.
Basically there are two memory limits:
- Virtual memory limit
- Physical memory limit
The heap uses virtual memory in order to allocate space, and the limit of virtual memory is more than that of the limit that is being allowed for stack by the OS.
For further clarification, check this out SIZE OF HEAP AND STACK .