lua-users home
lua-l archive

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

On Sunday 16 October 2005 07:30, Rici Lake wrote:
> First of all, if I had written Lua's garbage collector, I would have
> taken
> offence to your use of *real*. The Lua GC is a real garbage collector,
> and
> quite a reasonable one. It suffers from not being integrated with a
> memory
> allocator, perhaps, but the consequence is that it is fully portable.

Maybe my phrasing could have been improved... I'm used to academic research 
garbage collectors, which are system-wide and own all memory blocks, and 
usually have language support so they can do clever tricks like pointer 
manipulation to defragment memory. A 'mere' front-end to malloc strikes me as 
being, well, inadequate somehow, regardless of how well it works... although 
that'd disqualify libgc, too.

> Beyond that, the Lua garbage collector performs some tasks which are
> quite
> specific to Lua's semantics.

Yes, it does sound a bit of a nightmare --- I wasn't aware that libgc didn't 
support soft references, for example. Even so, it might be instructive to try 
benchmarking Lua running its own garbage collector on top of libgc; it'd be 
interesting to know in what way it behaved differently. It's also something 
that might be done in the real world, if you happened to write an application 
that embedded Lua and also used libgc.

+- David Given --McQ-+ "...electrons, nuclei and other particles are good
|    | approximations to perfectly elastic spherical
| ( | cows." --- David M. Palmer on r.a.sf.c
+- --+ 

Attachment: pgplmpvqukCtQ.pgp
Description: PGP signature