Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Background

I have just finished writing a compiler for a functional language compiling to the JVM as a learning project. However, since I'm just doing this to learn, I thought it might be interesting to write a native backend and a RTS for it.

As I've been planning out what this new backend will look like, the one point I'm stumbling on is the garbage collector. I've implemented the compiler in Haskell. But I have no desire to write the GC in Haskell since, while it may be possible, it'd suck.

Question

I've looked at several FOSS garbage collectors prior to posting and most of them were implemented in good old ANSI C. Is this still the most accepted choice for writing a GC nowadays?

I've seen that this site tends to frown upon questions with multiple answers so I hope this will make it more specific: If some startup was writing a professional grade gc today, are the only viable choice for them C or C++?

It's my first question here so please comment and let me know if this question is ill-suited for for programmers.

share|improve this question
3  
There are dozens of options: hardware GC, Forth, even a managed language-based GC (e.g., first prototype of .NET GC was implemented in Lisp). –  SK-logic Jun 30 '13 at 15:08
2  
Are there any actively maintained GCs like this? It'd be nice to see how they differ from the ones I've looked at so far. –  user95312 Jun 30 '13 at 15:11
    
Take a look at Tachyon meta-circular JavaScript JIT compiler, its GC is written in JavaScript, and it seems to be actively maintained. –  SK-logic Jul 1 '13 at 16:21
    
@SK-logic The .NET GC was written in Lisp yes, but the Lisp was compiled to C++ and avoided closures + other advanced lisp features.. See comments of blogs.msdn.com/b/patrick_dussud/archive/2006/11/21/… –  jozefg Jul 2 '13 at 1:07
    
@SK-logic: Very good to know. From where did you get this information? I want to know about .NET internals, like in what language is .NET's language and its compilers etc is written in. There's a lot of that say C++ but I think that they just assume this because is the language that almost all Microsoft product is written in (data from Microsoft). –  Jack Jul 4 '13 at 2:30

1 Answer 1

If some startup was writing a professional grade gc today, are the only viable choice for them C or C++?

No.

C is simply the lingua franca of systems programming, and often the first tool developers reach for when developing a new language, VM, or OS. That many GCs are written in C is simply a result of that fact.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.