symgc 0.0.1

SDC Garbage collector, ported to dmd


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

SDC Garbage collector, ported to normal D

This is a port of the SDC garbage collector to D code that builds with DMD/LDC/gdc.

The idea is to extract the GC portions of the SDC runtime (and everything needed) in order to be able to build using standard compilers.

Requirements

OS/Arch

  • Intel/AMD 64-bit CPU.
  • Linux or Windows (so far)

Compiler

  • DMD 2.111 -> Linux only, does not include features needed for Windows support.
  • DMD 2.112 (or unreleased master) or later. This is required for Windows support. It will also increase Linux performance.

Using

In order to use symgc, you should import the symgc.gcobj module. This will incorporate the symgc garbage collector as an option for your code to use. In order to use this GC, you must give druntime the name sdc as the gc requested. There are 2 ways to do this:

  1. Use an rt_options static configuration. e.g.:
extern(C) __gshared rt_options = ["gcopt=gc:sdc"];
  1. Pass the runtime parameter --DRT-gcopt=gc:sdc when starting your program.

Without either of these, your program will NOT use the symgc, but the default D conservative GC.

Using the GC in this way will print the message "using SYM GC!" to the console on stdout. If you wish to avoid this message, you can use the gc option sdcq.

Note that if you use symgc as a dub dependency, it will be copmpiled in the same mode as your code. This means, if you build in debug mode (the default), then the GC will not be optimized.

We are working on getting this set up as a dub dependency so you can include the GC optimized, regardless of your project's build settings.

Performance expectations

In our testing, the GC performs very well in terms of maximum physical RAM required. In some cases saving over 50% of the RAM needed for certain programs. This is likely to be the case for very high memory usage programs, but not nesessarily for small memory programs.

The performance of collection cycles is still a work in progress, and we are hoping to make this more efficient, but at the moment, some tests run much slower than the default GC, and some run faster.

Multithreaded performance should be much better than the default GC, as symgc does not have a global lock.

Todo

  • [ ] Provide mechanism to always include optimized GC.
  • [ ] ARM 64-bit support.
  • [ ] Mac/FreeBSD support.

Acknowledgements

Symmetry Investments is sponsoring this work.

Authors:
  • Steven Schveighoffer
  • Amaury Sachet
Dependencies:
none
Versions:
0.0.1 2025-Jun-27
~master 2025-Jun-27
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 0 downloads total

Score:
1.4
Short URL:
symgc.dub.pm