[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: destroy a variable
- From: Roger D Vargas <luo_hei@...>
- Date: Mon, 30 Apr 2007 10:06:23 -0400
Luiz Henrique de Figueiredo escribió:
If I repeatedly execute the string "a=math.random(1,20)" in my embedded
interpreter, when I stop the host I got a crash with a lot of glibc
errors.
Perhaps you're overflowing the stack? It shouldn't happen. Can you post
code? A minimal example would help.
This is the code that executes the string
void ScriptEngine::exec(string str)
{
if (str.length() > 0) {
int error = luaL_loadbuffer(luaVM, str.c_str(), str.length(),
"line") || lua_pcall(luaVM, 0, 0, 0);
if (error) {
cout << lua_tostring(luaVM, -1) << endl;
lua_pop(luaVM, 1);
}
}
}
In my code I simply do this, as a basic stress test:
scInt->exec("a=math.random(1,20)");
If I replace the code by "math.random(1,20)" no problems occurs.
Overflowing the stack does not explain this.
Is there any way to destroy variables used in an script when I dont need
them anymore?
Set them to nil, but you shouldn't have to do that.
--lhf
--
http://dsgp.blogspot.com | Linux, programación, juegos
Have no place I can be since I found Serenity
But you can’t take the sky from me
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com