lua-users home
lua-l archive

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


Andrew Teirney wrote:
>What i have noticed is that i load a chunk, it executes, then the chunk
>ends then there seems to be more memory used, i the same chunk again
>and then it uses up more memory

Loading a chunk allocates memory. If you wanto to run a chunk several
times, load it once and run it several times: the result of lua_load and
luaL_load* is a function on the stack that represents the main part of
the chunk; it can be called several times without having to reload the
chunk (but you have to save the function somewhere; it is removed from
the stack when it is called.)

>What i am wanting to know is how after running the below script can i
>free any internal structures related to that script

Garbage collection does this for you automatically.
--lhf