Introduction to GC

The GC package contains the Boehm-Demers-Weiser conservative garbage collector, which can be used as a garbage collecting replacement for the C malloc function or C++ new operator. It allows you to allocate memory basically as you normally would, without explicitly deallocating memory that is no longer useful. The collector automatically recycles memory when it determines that it can no longer be otherwise accessed. The collector is also used by a number of programming language implementations that either use C as intermediate code, want to facilitate easier interoperation with C libraries, or just prefer the simple collector interface. Alternatively, the garbage collector may be used as a leak detector for C or C++ programs, though that is not its primary goal.

This package is known to build and work properly using an LFS 7.9-systemd platform.

Package Information

  • Download (HTTP): http://www.hboehm.info/gc/gc_source/gc-7.4.2.tar.gz

  • Download MD5 sum: 12c05fd2811d989341d8c6d81f66af87

  • Download size: 1.1 MB

  • Estimated disk space required: 9.7 MB (additional 2.3 MB for the tests)

  • Estimated build time: 0.2 SBU (additional 0.2 SBU for the tests)



User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/gc

Installation of GC

Install GC by running the following commands:

sed -i 's#pkgdata#doc#' doc/doc.am &&
autoreconf -fi  &&
./configure --prefix=/usr      \
            --enable-cplusplus \
            --disable-static   \
            --docdir=/usr/share/doc/gc-7.4.2 &&

To test the results, issue: make check.

Now, as the root user:

make install &&
install -v -m644 doc/gc.man /usr/share/man/man3/gc_malloc.3 &&
ln -sfv gc_malloc.3 /usr/share/man/man3/gc.3 

Command Explanations

sed -i 's#pkgdata#doc#' doc/doc.am and --docdir=/usr/share/doc/gc-7.4.2: These commands are used so the package will install the documentation in a versioned directory.

autoreconf -fi: This regenerates the configure script and the Makefile.in files.

--enable-cplusplus: This parameter enables the building and installing of the C++ library along with the standard C library.

--disable-static: This switch prevents installation of static versions of the libraries.


Installed Programs: None
Installed Libraries: libcord.so, libgc.so and libgccpp.so
Installed Directories: /usr/include/gc and /usr/share/doc/gc-7.4.2

Short Descriptions


contains a C interface to the conservative garbage collector, primarily designed to replace the C malloc function.


contains a C++ interface to the conservative garbage collector.

Last updated on 2016-03-31 18:05:44 -0500