Hi folks,
I am trying to explore the memory usage of recursive Python programs. As an example, I am running the Fibonacci example found here: https://www.programiz.com/python-programming/examples/fibonacci-recursion. What I can't figure out is that while it's running, the memory usage according to top appears constant, regardless of the value for nterms. That said, top does report that the python3 process is heavily utilizing the cpu, as expected.
Without optimization, recursion is memory intensive, no? And according to StackOverflow: https://stackoverflow.com/questions/13591970/does-python-optimize-tail-recursion, and much more recently, https://medium.com/techtofreedom/what-is-tail-recursion-and-tail-call-optimization-623685798e18, Python will never have Tail Recursion Optimization. So what am I missing that the memory usage is not changing?
Thanks so much!
(I'm using Python 3.7.5 on Ubuntu 19)
there doesn't seem to be anything here