lua-users home
lua-l archive

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


On Fri, Sep 2, 2011 at 16:25, Mike Pall <mikelu-1109@mike.de> wrote:
> Patrick Rapin wrote:
>> function Test()
>>       local function Internal()
>>       end
>>       for i=0,10000000 do
>>               Internal()
>>       end
>> end

> You're creating a new closure for Internal() on every call. Don't
> do that. LuaJIT specializes to each closure and there's a limit to
> that. Create the closure outside of Test().

I suspect that calling collectgarbage("step") from time to time should
also help. No?

(But, of course, closure creation ought to be outside of the function
in this case.)

Alexander.