lua-users home
lua-l archive

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

Hi all,

In Lua 5.0, you could effectively use collectgarbage() to limit the
memory usage of a Lua script, entirely from Lua.  While going through
some of my older scripts, I've noticed that this functionality no longer
seems to be present in Lua 5.1, as the garbage collector is based on
percents and not kilobyte values.

Is there an effective pure-Lua way of limiting memory usage in Lua 5.1?
 I can use a hook function to get how much memory is currently being
used and abort if the limit is reached, but this is not a 'clean'
solution, in my opinion.