lua-users home
lua-l archive

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


>From lua-l@tecgraf.puc-rio.br  Wed Jun 21 04:35:35 2000
>From: "Mauro Vezzosi"<mvezzosi@libero.it>

>1) At the start of my programs I load some my libraries written in Lua, 
>but it is rare that I use all the functions of the libraries. Is there 
>a simple method to know in runtime which functions are never used, so I 
>can free them ? (analizing only the bytecode if possible, because the 
>source couldn't be always available)

One simple way is to look at all GETGLOBAL opcodes.
See test/globals.lua.
Of course, this doesn't cover all cases, but it should cover most cases.
(It doesn't cover anonymous functions or global functions whose name is built
in run time.)
--lhf