[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: state of the Lua nation on resource cleanup
- From: Florian Weimer <fw@...>
- Date: Sat, 30 May 2009 22:03:55 +0200
* Cosmin Apreutesei:
> I think the problem with ref-counting is the performance hit of the
> cycle detection algorithm (although it's usually small potatoes
> compared to the finalization code itself -- as it was noted before,
> even triggering collectgarbage() usually takes less) -- cycles may not
> be such a big problem in practice, but if you go down that path, you
> gotta have full correctness. There might be better ways to implement
> determnism in gc, just don't know of any myself.
I fear it's very costly to detect that a Lua value needs to be
reference-counted. Basically, you pay for the cost even if you don't
use this feature. Currently, if you pass a Lua value between
functions, or store it in a table, the value doesn't need to be
examined at all, it can be copied as-is. Reference counting will
change that, even if it is optional.