[MUD-Dev] [Tech] Garbage collection

Jay Carlson nop at mitre.org
Mon Sep 8 15:11:55 CEST 2003


<EdNote: Minor editing for clarity done>

On Mon, 2003-09-01 at 15:40, Brian Hook wrote:

> I've been doing some more research into garbage collection lately
> and I'm trying to get a feel for what the current major MUD
> languages/engines use for garbage collection.

LambdaMOO uses reference counting.  Although reference counting is
error-prone and inefficient as a memory management strategy, it does
have one significant benefit: you can find out cheaply if there are
multiple references to a data structure.

This is important for MOO because composite data types (other than
objects) have immutable value semantics.  Operations such as

  l[6]=e 

are sugar for 

  l = listset(l, e, 6)

In the general case, listset copies 'l', and updates its copy before
returning it.  The refcount of the old value of 'l' is then
decremented as the assignment happens.

However, if you can determine that 'l' is the only reference to a
list, it can be updated in place.  Paraphrasing Dan Ingalls, "the
implementor *may* cheat, but must not get caught."

  http://users.ipa.net/~dwighth/smalltalk/St76/Smalltalk76ProgrammingSystem.html

which was the cite I was looking for back in

  http://eli.elilabs.com/mcarc/04-97/msg00038.html 

Ben Jackson did some significant work in exposing more "'l' is the
last reference" situations in generated bytecode.  It sure made my
Apple II emulator faster...

--
Jay Carlson <nop at mitre.org>
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list