Re: newbie: VM asynchronous control from C Side

  • From: Adam Strzelecki <ono@xxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 23 Jun 2012 21:52:31 +0200

> I also need to know how to asynchronously force a clean "Abort"...
> Let say the script is runing, the user closes the main C application;
> how can I abort the VM leaking memory and things like that..
> is it possible?

Well it it happens during main C application close anyway it runs within 
process' context that will be released by OS - even you don't free memory, OS 
will do it for you. I have seen some (POSIX?) recommendations not to free 
memory at the process end as it is just wasted effort, because anyway OS will 
recover all process used VM pages back to free pool much more effectively.

Otherwise it is really interesting idea of using Lua as "limited trust" user 
scripting language. Ruby for example has interesting security/sandboxing 
concept, but this applies for OS API and external resources access. But I don't 
recall any CPU supervisor solution for Lua, neither Ruby.

However for example from Safari 5 (AFAIR) web context including JS scripting 
and Plugins run within separate process (from main Safari app), so when it 
dies, the main app say untouched.

Maybe running you scripts within separate process can be some solution for you?

Regards,
-- 
Adam Strzelecki | nanoant.com | twitter.com/nanoant


Other related posts: