lua-users home
lua-l archive

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


Hi!

I've spent all day trying to track down a bug in my app, and
I discovered that my app is pushing 26 items onto the stack and
corrupting the heap.  This is lua 5.0.2.  The stack is doc'd at
20 items so quietly trashing memory wasn't the unexpected thing
for Lua to do but it was a bit annoying to track down (and who
really counts their returns? :) ).

I could noodle around and make this particular instance into
a single table that's returned, but I can foresee myself
writing a similar function in the future that slowly gets more
returns added to it over time and again quietly blows the stack.

The 'quietness' of it is annoying but it isn't the issue.  Neither
is the issue that the default stack is 'only' 20 items, since I
know I can change that.  The issue is that I'd really quite like
to not worry about how much stuff I push onto the stack. :)

So, I was wondering if there was an official or unofficial API
call for expanding the stack space, so I can write safe wrappers
for lua_push*().  I don't see anything obvious in the manual.

Otherwise I'll just up LUA_MINSTACK to a large value and
scatter some lua_checkstack()s around for runtime aborts, but
that doesn't seem as pleasant as using a 'safe' stack that'll
expand as needed.

Thanks,
--Adam
--
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3