lua-users home
lua-l archive

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


Hi,

I'm running lua (5.0.2) on a embedded device (e.g. limited amount of RAM available).
When does the gc kick in during lua code execution?

Here's what I've got:
A bunch of lua code is running and I have about 100k RAM left (using 200k,
as reported from gcinfo), I keep the gc threshold at 280k, which keeps the
app running under normal op. However, when I loop over a function that uses
quite a bit of RAM it bails out the second time around with: not enough memory.

I call collectgarbage before each iteration, and the processing each times is
as good as identical.

What I'm after is, there still should've been enough memory, should only the
gc have run in time (somewhere in the middle of the function to free up some
of the intermediate calculations no longer in use..)

What am I missing?

Hope my thoughts make sense

//Andreas