Fourteen Thousand Frames Deep

The stack grows down from the top of the address space into the gap stack (8 MiB limit) unmapped gap heap text and data high low

A recursive traversal is compiled at -O0. Each activation of the function occupies 560 bytes: a 512-byte local scratch array plus 48 bytes of return address, saved frame pointer, spilled arguments and 16-byte alignment padding. The thread runs with the default ulimit -s 8192, an 8 MiB stack.

Roughly how many frames deep can the recursion go before it touches the guard page?

A

about 1,048,576

B

about 14,979

C

about 16,384

D

about 174,763