lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm currently using lua on an embedded system with limited resources
(ColdFire 5282 for the curious).  I was experiencing weird crashes
which I eventually traced back to stack overflows.  It seems that lua
uses up 6k or so of stack.  On systems without an MMU, this causes a
bit of a problem.

Most of that space is taken up by multiple copies of FuncState being
put on the stack.  I reduced the stack usage a bit by decreasing
MAXUPVALUES and MAXVARS, which affect the size of the FuncState
structure.  I suppose the FuncState could put on the heap, but I don't
want to go there if I don't have to.

I'm posting this for two reasons.  One, in case someone else runs into
a similar problem and is looking for a way to reduce stack usage.  And
two, to ask if anyone has any other tips for reducing stack usage.

Zachary P. Landau <>