lua-users home
lua-l archive

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

Matt Campbell wrote:
I don't wish to debate reference counting versus mark-and-sweep. I merely wish to try reference counting in my Lua 5.1-based project with a minimum of change (e.g. not switching to LuaPlus). So does anyone know of a patch that adds reference counting to Lua 5.1? Of course, I don't mean the Lua reference system, I mean reference counting as an alternative to mark-and-sweep GC. Thanks.
I believe the standalone LuaRC (for Lua 5.0) on is up to date with the LuaPlus for Lua 5.0 reference counting implementation. While I successfully shipped several products with it, I have heard from others that it doesn't handle every case in their own Lua development and crashes. In my opinion, those instances are fixable, but I never received repros.

I never moved the reference counting code to Lua 5.1, but I have been tempted to do so at times. A lot of change happened to the Lua core between Lua 5.0 and 5.1, and I'd have to pretty much start from scratch to bring up the reference counting.

It certainly has its advantages and coupled with the incremental collector in Lua 5.1, it would be very fast. It was satisfying for the console work I was doing to know when I create a short-lived string or table, they were going to clean themselves up as soon as they go out of scope.