views:

65

answers:

2

Are there any "good" C libraries for garbage collection?

I know about the Boehm GC, is it maintained nowadays?

What about http://tinygc.sourceforge.net?

What are your experiences with these libraries?

+2  A: 

In my humble opinion: if you have problems in C using malloc() and free() correctly, you should swith to another language (maybe JAVA), which has a GC build into the concept of the language.

every tool has its purpose and its range of usability, and C is not designed for GC. If you flansch a GC on C you get a lot of overhead to get it "right", which will result in loss of speed and clarity.

Peter Miehle
It was never stated that he didnt know how to use malloc and free correctly. Even if you know how to use them, certain projects might benefit from automatic GC.
Chimmy
I'm just building a (managed) runtime for a "small" language, I want to see how a standard GC will perform before attempting to roll my own.
need_a_gc_library
Yes, Java manages its own memory, but this is out of necessity; Java isn't exactly a small language.
amphetamachine
+3  A: 

You could use Boehm's Garbage Collector. Many projects I have worked with use it.

amphetamachine
The drawback is: it is not plattform independent, as most GCs for C.
Peter Miehle
@Peter Miehle: Yes it is: "The distribution includes ports to most standard PC and UNIX/Linux platforms. The collector should work on Linux, *BSD, recent Windows versions, MacOS X, HP/UX, Solaris, Tru64, Irix and a few other operating systems."
amphetamachine