[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: rapid lifetime based collection of transient user data objects?
- From: Joshua Jensen <josh.jjensen@...>
- Date: Sat, 29 Oct 2011 20:32:21 -0600
----- Original Message -----
From: Ross Bencina
Date: 10/29/2011 1:45 AM
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  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.
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?
All objects are reference counted. The incremental collector in Lua 5.1
can still be called.
or can it be applied selectively to certain types?
No. If you are going to end up with cycles, you'll need to call
lua_gc() on occasion.
Does it perform cycle detection?
Well, the majority of the time, it isn't necessary to call lua_gc() at
all. If you never have a cycle, you should never really need to call it.
How does it performe compared to the standard Lua GC?
Weak tables are not handled, if I recall correctly.
In terms of performance, reference counting occurs, and that adds
overhead to any TValue manipulation. On the other hand, deterministic
finalization means that objects will fall out of scope at an 'end'.
Memory is kept under control all the time.
The benchmarks against LuaRC 5.0  look good.
I am unaware of anyone using the reference counting implementation under