[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Limiting memory usage without C
- From: Irayo <irayo.lt@...>
- Date: Sun, 20 Jul 2008 18:09:03 -0500
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.