lua-users home
lua-l archive

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


on 8/23/05 3:23 AM, David Given at dg@cowlark.com wrote:

> This *doesn't* put limits on CPU time and memory usage, but you can do that
> fairly easily by using the C API --- you'd set a timer that, when fired,
> would cause the sandboxed program to be terminated. By putting a bound on the
> amount of CPU time you automatically put a bound on the amount of memory, but
> that can be customised as well.

And for reference for the Lua cookbook, the place to look to see how to do
that is the standalone, command-line Lua interpreter and see how it handles
interrupts. The key point is that setting debug hooks is thread safe so you
can set the hook proc at interrupt time which is a lot more efficient than
setting it earlier and having it check a flag.

Mark