what is the maximum size of stack and heap?
Yogesh Jadhav
On some systems you can allocate any amount of memory that fits in the address space. The problems begin when you start actually using that memory.What happens is that the OS reserves a virtual address range for the process, without mapping it to anything physical, or even checking that there's enough physical memory (including swap) to back that address range up. The mapping only happens in a page-by-page fashion, when the process tries to access newly allocated pages. This is called memory overcommitment.Try accessing every sysconf(_SC_PAGESIZE)th byte of your huge arrays and see what happens.