Using Mono SGen Garbage collector in C/C++ programs
Is 开发者_运维百科it possible to use SGen garbage collector (from the mono runtime) in coventionnal C/C++ programs ? I think mono used also the Boehm-Demers-Weiser conservative garbage collector that can be used in C/C++ programs.
There are very few dependencies on the rest of the Mono code in SGen, so it should be easy to extract it out and adapt to other uses. The major difference from the Boehm collector is that it currently doesn't support a non-precise mode for heap objects, so you can't use it to replace malloc easily. It would work great, though, for managing objects for which you could provide precise reference information.
Not sure about the garbage collector that you have specified. But do you really need to use a GC on a C++ project? I never felt the use of a GC in my C++ projects. You should be good if you follow the best practices and use a decent smart pointer.
精彩评论