next up previous contents
Next: What Is Giggle? Up: Quick Start Previous: Installation

Write Programs

To write a program that allows you to choose a garbage collector when you run it from the command line, use demo0001.cxx as a skeleton: ``cp demo0001.cxx myprog.cxx''.

Edit myprog.cxx. Find the function Run. Gutt the thing & insert your code.

Compile & link your program: ``g++ myprog.cxx -lcybertiggyr-giggle''. (If you have the Boehm collector installed, append a ``-lgc'' to that.)

Run your program: ``myprog -t type'' where type is the type of collector you want to try:

rc reference counting (default)
sweep mark-&-sweep
hybrid rc + sweep
boehm the Boehm collector
lazy deallocate everything at end

Compare the run-times & leaks of the different collectors. Reference counting is the fastest, but it leaks if you data has circular references. Mark-&-sweep never leaks, but it's very slow. The hybrid collector is a mark-&-sweep collector that also counts references in the hopes of saving time with cheap shots. The Boehm collector might be the only way to interface with C code that benefits from garbage collection, but it can leak. The lazy collector doesn't collect anything until the collector, itself, is destroyed, & then it deletes everything. It exists mostly for comparison purposes.


next up previous contents
Next: What Is Giggle? Up: Quick Start Previous: Installation
Gene Michael Stover
2002-04-28