lua-users home
lua-l archive

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

-----Original Message-----
From: Nick Trout []
Sent: 24 October 2002 21:54
To: Multiple recipients of list
Subject: RE: Garbage collection

> Do you just use lua_ref and unref?

No, I am using Lua 4 we haven't oved on to 5 yet so I dont know how the GC
works for that. lua_ref keeps a list of object that have been referenced.
When the GC is called it goes throught this list and marks the objects. This
ends up being a deep marking process down through tables. It then does the
global table and stack etc in the same way. So using lua_ref saves no time
on marking.

> So as it stands you cannot use the M&S GC without seperating this out.

Because it reuses the fields m&s is replaced.

> If everything is marked, can you not free it when the ref count (with no
> mark) is 0? I assume you can't do this because you something nasty might
> happen in the Lua executor and you'd rather free stuff outside of there.

No. As desribed earlier, the lua_ref lock system does not mark any objects
until it calls the gc routine. Although a ref count may be at 0, the object
may be in the lock list.

> Reenable M&S GC and call that! Perhaps once its made generational,
> working with the RC objects, the hit will be minimal.

yeah cant wait to see that. Our user data usage hit is for new objects. This
will cheapen the marking process. It would be nice it lua allowed you to
spread the ammount of collection being done so the sweep didnt take so long
and did less at a go. We could then set a M&S size that didnt effect our
engine performance.