Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What are the two kinds of garbage collectors for C++?

collectors garbage
0
10 Posted

What are the two kinds of garbage collectors for C++?

0

In general, there seem to be two flavors of garbage collectors for C++: • Conservative garbage collectors. These know little or nothing about the layout of the stack or of C++ objects, and simply look for bit patterns that appear to be pointers. In practice they seem to work with both C and C++ code, particularly when the average object size is small. Here are some examples, in alphabetical order: • Boehm-Demers-Weiser collector • Geodesic Systems collector • Hybrid garbage collectors. These usually scan the stack conservatively, but require the programmer to supply layout information for heap objects. This requires more work on the programmer’s part, but may result in improved performance. Here are some examples, in alphabetical order: • Attardi and Flagella’s CMM • Bartlett’s mostly copying collector Since garbage collectors for C++ are normally conservative, they can sometimes leak if a bit pattern “looks like” it might be a pointer to an otherwise unused block. Also they sometimes

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123