From: Peng HaiJie
Subject: Problem on deeply recursion
Date: 
Message-ID: <3AE3B51E.95959F6C@cn.freebsd.org>
>····@acm.org wrote:
>Since your function is tail recursive, the compiler should be able to
>do tail call optimization, thereby turning your function into an
>iterative one, so that this shouldn't eat all your memory (it uses
>more or less constant memory, modulo growing bignums).  So did you
>compile your function (using compile or compile-file + load)?
I compiled it.

>The other problem you might have run into is that printing large
>bignums takes really much space, i.e. to print the result of
>(! 10000), 18c currently takes around 33 MB of space.  So unless you
>really need to see the result of (! 10000), it might be more
>appropriate to invoke it like this
>
>* (progn (! 10000) nil)
>
>in order to avoid the result being printed by the top-level oop.
After I disabled all my deep recursion functions,the
phenomemon(cmucl ate up all memory)will never happen.

Calculate (! 50000) with Allegro CL 6.0 trial version gives
following error message:
Error: An allocation request for 4216 bytes caused a need for 3670016
more
       bytes of heap. This request cannot be satisfied because you have
hit
       the Allegro CL Trial heap limit.  If you wish to purchase Allegro
CL
       please contact Franz Inc. at ·····@franz.com or by calling (510)
       548-3600.

I used clisp to calculate (! 50000),I found the size of the value
is a bit less than 213354 bytes.(and use less than 20 secs to compute it
out)
[compiling (! 50000) in a file with clisp,this value will output to
the  .fas file]

I'm curious that why clisp can do it with low memory,but cmucl can't do,

maybe Allegro can't either(I haven't test it,not the trial version).

I don't know internal of cmucl,so I can't figure out what the reason is.

I'm using a PIII 550 box with 128M mem on FreeBSD 4.3RC.
cmucl-18c with CLX and Motif graphical debugger enabled.

regards

        -phj