[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Simple Lua for scripts
- From: Mark Hamburg <mhamburg@...>
- Date: Tue, 23 Aug 2005 08:41:15 -0700
on 8/23/05 3:23 AM, David Given at email@example.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.