lua-users home
lua-l archive

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



On Jan 21, 2014, at 9:51 PM, Andrew Starks <andrew.starks@trms.com> wrote:


On Tue, Jan 21, 2014 at 10:42 PM, Tim Hill <drtimhill@gmail.com> wrote:
They are garbage collected. Roberto did an interesting paper a while back on how Lua handles upvalues. As I recall it, they start on the stack and are migrated out of the stack when the declaring function (not referencing function) goes out of scope. So when your outer function returns, they logically move from the stack to the heap. Remember, though, that things on the stack can be GCed too; in languages like Lua the distinction between the stack and heap is less clear-cut that C or C++.

Thanks, Tim. That's clear now.

I was hoping to trade garbage collection pauses for stack overflows. :)

-Andrew

Why not have both :))))

—Tim