How to predict the maximum call depth of a recursive method?

后端 未结 6 1327
太阳男子
太阳男子 2020-12-12 23:39

For the purposes of estimating the maximum call depth a recursive method may achieve with a given amount of memory, what is the (approximate) formula for calculating the mem

6条回答
  •  旧时难觅i
    2020-12-13 00:15

    depends on your system-architecture (32 or 64 bit addresses), the amount of local variables and parameters of the method. If it is tail-recursive no overhead, if the compiler optimize it to a loop.

    You see, no simple answer.

提交回复
热议问题