> > I added that warning in myself after getting enough reports.  I narrowed
> > the size to 2400K to match the default Tcl eval stack recursion limit of
> > 1000.  I think 4M is more than you need, 1M will likely do it, and 2400K
> > covers all the bases.
>
> Jeff, for those of us not especially familiar with the Tcl internals,
> could you give or point us to a basic explanation of how and why Tcl
> uses the C stack, as opposed to being "stackless"?  (A Google search
> for "stackless Tcl" turns up some interesting links, but doesn't seem
> to really answer this question.)

It's simple in that a call like so:

proc a args { return "foo" }
proc b args { a }
proc c args { b }
c

will cause an "eval stack" push for the calls to 'a' and 'b'.  This means
you will see something like "Tcl_EvalObj" (or some equivalent) multiple
times in a C stack trace if you were to have a breakpoint in 'a'.  The
reason for a limit is that infinite recursion will hit the C stack limit
and go boom.  I've never seen the limit hit (assuming a normal C stack
or 1000 Tcl eval call depth) except in infinite loop cases.

Note that 8.4 also has exposed a way to reduce that limit (and prevent
segfault) at the Tcl level with:

        interp recursionlimit

for those who may not be able to adjust stack with (u)limit.

  Jeff Hobbs                     The Tcl Guy
  Senior Developer               http://www.ActiveState.com/
      Tcl Support and Productivity Solutions

Reply via email to