lua-users home
lua-l archive

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


On Oct 5, 2009, at 6:15 PM, E. Wing wrote:

Meanwhile, I patched the existing legacy bridge to be garbage
collection aware and fixed up some major memory leaks.

Dueling garbage collectors are generally a pain. On Lightroom, we found it advantageous to be using the reference counted version of Objective-C with Lua's garbage collector. Did you actually come up with a reasonable way to handle the Lua object A points to Objective-C object B which points to Lua object A case? In a simple dual GC implementation (e.g., using refs or the equivalent to refer to Lua objects), the objects end up as roots because of the foreign references and the collectors end up waiting for the other to go first in breaking the cycle. Lightroom uses the reference count information to detect when the only reference to an Objective-C object is from the Lua side and change its handling at that point.

Mark