lua-users home
lua-l archive

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

--- In lua-l@y..., Luiz Henrique de Figueiredo <lhf@t...> wrote:
> >Just writing to see if anybody has done something like this 
before. I 
> >think is causing our program to leak memory slowly because we are 
> >confusing lua.
> >
> >What we have done is basically written a C-function called by lua 
> >which passes a ID refering to another lua script so that we could 
> >call another lua script from lua..i.e. script 1 runs...executes 
> >funcition which executes another lua script using the same L state 
> >pointer and then returns to the original script which continues..
> >
> >Not sure if this would cause a leak in lua, but I think it is and 
> >just wanted to check before I get alot of our script re-written to 
> >find out it isn't.
> Please give more details. You mentioned lua_dobuffer in the Subject
> but not in the body. Are you running precompiled code or text in 
> buffers?
> --lhf
We are running pre-compiled code. We wanted a way to 'modularize' our 
Basically we are:
1) Getting a pre-compiled buffer area(hashed via an id)
2) running it using lua_dobuffer
3) In the script it may call out to C function which
   will get another piece of pre-compiled code which get executed
(using the same L state passed to the C function)
4) returns to the main 'calling script'

Not sure if this would be any help but I am doing a lua_gettop(L)
and lua_settop(L) before and after the lua_dobuffer just to reset the 
stack(I saw this some where before for fixing memory leaks).

Hope this is enough info