Donation: Simple garbage collection system.

I shall be posting the source code for the following onto the
newsgroup comp.sources.Delphi in the near future:

Simple Garbage Collection system for Delphi 1 and 2.

Martin Harvey 14 August 1997.


I'm currently writing a couple of lexical analysers and parsers using
Lex and Yacc. I encountered a severe problem when writing the parser:
if the input to the parser is syntactically incorrect, then the parser
quits before building a proper syntax tree. Since the parser in
question creates a whole load of objects, and links them together into
a tree, this meant that I has various fragments of a parse tree stuck
inside the internal stacks in the parser, and I couldn't figure out a
way of going through the parser stacks and destroying them.

I eventually decided to make a simple garbage collection system. This
works by having objects register with the garbage collector upon
creation, and un-register upon destruction. The garbage collector has
a couple of procedures that can be called at any time which will
destroy all garbage collectable objects.

For more details please look at the code and comments therein.

NOTE: This software is not for novices. Although the garbage collector
looks very simple, and not much code is involved, a sound
understanding of inheritance, containment and polymorphism is required
in order to make this code work successfully for complex structures.


Martin Harvey
Uni email:
6D 63 68 32 34 40 63 61 6D 2E 61 63 2E 75 6B
Home email:
6D 63 68 32 34 40 68 61 72 76 65 79 32 37 2E 64
65 6D 6F 6E 2E 63 6F 2E 75 6B
Decode the HEX back into ASCII chars.
Uni web pages: