[PRL] almost tail-calling (was: Re: deeep stack)

William D Clinger will at ccs.neu.edu
Fri May 23 13:59:48 EDT 2008


John Clements wrote:
> Just now, I decided to see how deep you could go (see *1* below), and
> I got to
>
> 518660
>
> That is, Java's not tail-calling, but that's not bad.  Now, these are
> itty bitty stack frames.  Adding another argument to the procedure
> pulls this down to 346000, and adding a third brings it down to 259000.

This is implementation-dependent, of course.

If this is Sun's JVM, then the numbers cited are
a big improvement over a few years ago, when stack
overflows would occur after about 10,000 recursive
calls.

Will



More information about the PRL mailing list