3 ms·
I assume you mean you are using rust to implement your language rather than that you are implementing rust. If that's the case whether or not you need a garbage
by bradleyjg 9y ago
I assume you mean you are using rust to implement your language rather than that you are implementing rust. If that's the case whether or not you need a garbage collector comes down to deciding whether or not you want users of your language to have to allocate memory manually or not. As for as when goes, it can come relatively late in the development of the language. Not having a garbage collector or any other way of freeing memory will make it likely that programs written in your language will run out of memory, but with so much memory on modern computers you'll be able to write more than trivial programs without running into that problem.
A simple stop-the-world mark and sweep GC without any generations should be relatively easy to implement. https://blogs.msdn.microsoft.com/abhinaba/2009/01/30/back-to-basics-mark-and-sweep-garbage-collection/ https://blogs.msdn.microsoft.com/abhinaba/2009/01/30/back-to...
- rurban 9y agoNo, please don't make the mistake of adding another slow and bad mark & sweep GC. Do it properly with a simply copying collector. It can be much shorter than a mark & sweep also.