简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM