Garbage Collection
In response to andy's mark and sweep garbage collector for C++, I went ahead and wrote my own. My primary goal was to make it easy to use. (Unfortunately, I failed. At least it was fun.)
Advantages
- Works in standard C++.
- You have complete control over when collection occurs.
- Relatively straightforward...
Disadvantages
- HORRIBLE running time. It should be O(n) or less, but I think it's O(n lg n) right now.
- Requires modification to the classes you want to collect.
- Nonintuitive API for making fields (member pointers to other classes).
- Easy to forget that you need smart pointers for GC to work.
- Not thread safe.
- No weak references.
- No support for incremental or generational GC.
It's been a while since I've done some good old fashioned R&D... The GC works, and that's as far as I wanted to take it. I did some looking around and noticed that there is a lot of interest for a GC smart pointer in boost... so hopefully we'll see it before too long. :)
Also: I have no self-discipline. :(