1 Title: Naive Garbage Collector
2 Tags: en, d, dgc, tango, gc, naive, mark-sweep, howto
4 I was working in a naive garbage collector implementation for D, as a way to
5 document the process of writing a GC for D.
7 From the Naive Garbage Collector documentation:
9 The idea behind this implementation is to document all the bookkeeping and
10 considerations that has to be taken in order to implement a garbage
13 The garbage collector algorithm itself is extremely simple so focus can be
14 held in the specifics of D, and not the algorithm. A completely naive mark
15 and sweep algorithm is used, with a recursive mark phase. The code is
16 extremely inefficient in order to keep the code clean and easy to read and
19 Performance is, as expected, **horrible**, **horrible**, **horrible** (2 orders
20 of magnitude slower than the *basic* GC for the simple `Tango GC Benchmark`__)
21 but I think it's pretty good as documentation =)
23 __ http://www.dsource.org/projects/tango/wiki/GCBenchmark
25 I have `submitted the implementation`__ to Tango__ in the hope that it gets
26 accepted. A git__ repository__ is up too.
28 __ http://www.dsource.org/projects/tango/ticket/1620
29 __ http://www.dsource.org/projects/tango/
30 __ http://git.llucax.com.ar/git-logo.png
31 __ http://git.llucax.com.ar/w/software/dgc/naive.git
33 If you want to try it out with LDC__, you have to put the files into the
34 ``naive`` directory in ``tango/lib/gc`` and edit the file
35 ``runtime/CMakeLists.txt`` and search/replace "basic" for "naive". Then you
36 have to search for the line::
38 file(GLOB GC_D ${RUNTIME_GC_DIR}/*.d)
42 file(GLOB GC_D ${RUNTIME_GC_DIR}/gc/*.d)
44 __ http://www.dsource.org/projects/ldc
46 Comments and reviews are welcome, and please let me know if you try it =)
48 .. vim: set et sw=4 sts=4 :