Isn't this how Python itself implements function calls, using the host (C) stack? Hence Python's lack of support for stackful coroutines?
import sys
sys.setrecursionlimit(2 ** 32 - 1)
def recurse():
recurse()
recurse()
This code attempts to create unboundedly many Python stack frames. If those frames were allocated on the heap, you would expect it to either throw an exception or else display symptoms of memory exhaustion. Instead, it segfaults.On the other hand CPython in fact does extra work because it also creates heap allocated frame objects (which essentially mirror the C stack) for debugging purposes.
Your experiment shows that the C stack overflows faster than the heap. It does not show that no heap space is consumed at all.
No? Pretty much the entire point of the recursion limit is to protect against segfaults.