[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Garbage collection (was: Calling C++ class methods from Lua (newbie))
- From: David Given <dg@...>
- Date: Tue, 18 Oct 2005 01:59:11 +0100
On Sunday 16 October 2005 07:30, Rici Lake wrote:
> First of all, if I had written Lua's garbage collector, I would have
> offence to your use of *real*. The Lua GC is a real garbage collector,
> quite a reasonable one. It suffers from not being integrated with a
> 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
> 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
| firstname.lastname@example.org | approximations to perfectly elastic spherical
| (email@example.com) | cows." --- David M. Palmer on r.a.sf.c
+- www.cowlark.com --+
Description: PGP signature