lua-users home
lua-l archive

Re: A Problem about lua-5.2.0's code

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


> 642| setptvalue2s(L, L->top, tf);
> 643| incr_top(L);
> 644| cl = luaF_newLclosure(L, tf);
> 645| setclLvalue(L, L->top - 1, cl);
> It seems that the code in line 642 is useless. Because the stack entry will be cover by the code in line 645.
> Is it really useless or it has other effect?
It serves to anchor tf to avoid it being collected if a collection is
triggered inside luaF_newLclosure. (Functions that allocate memory can
trigger collections.)

AltStyle によって変換されたページ (->オリジナル) /