lua-users home
lua-l archive

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

On 29/10/2011 6:03 PM, Joshua Jensen wrote:
I can't recall if I ever did a standalone LuaRC 5.1, but the reference
counting is definitely in the LuaPlus [1] source code. Look for
LUA_REFCOUNT and copy the changes into your copy of Lua. It works in
almost all instances, and it is very effective at keeping memory under
control. I also like that it adds deterministic finalization to Lua.

Thanks for your fast reply Josh,

Is there a write-up somewhere of how the LuaPlus reference counting works? I'm wondering about things like: Does it replace the current Lua GC with reference counting for all objects? or can it be applied selectively to certain types? Does it perform cycle detection? How does it performe compared to the standard Lua GC?

One thing that would concern me about using eager reference counting for absolutely everything is that it could cause spikes in CPU usage when a large tree of objects becomes unreachable -- whereas with incremental GC the time taken by a GC cycle can be bounded. Perhaps there is a way of having incremental/bounded time resource deallocation with reference counting too.