As for label markup (lazy approach) for garbage collection in C ++?

I know the method of the counter, but still have not heard about the markup method when I read a book called "Concepts of a programming language."
According to the book:

The initial process of sorting garbage assemblies works as follows: the runtime system allocates memory cells in accordance with requests and, if necessary, disconnects pointers from cells, not paying attention to the reclamation of the storage (allowing garbage collection) until it selects all available cells. At this point, the pegging process begins to collect all trash left in the heap. To facilitate the process, each heap cell has an additional indicator bit or field, which is used by the collection algorithm.

From my limited understanding, smart pointers in C ++ libraries use a reference counting method. I wonder if there is any C ++ library using this kind of implementation for smart pointers? And since the book is purely theoretical, I could not imagine how the implementation is carried out. An example to demonstrate this idea would be very valuable. Please correct me if I am wrong.

Thank,

+5
source share
2 answers

There is one difficulty in using garbage collection in C ++ to determine what a pointer is and what is not.

, , , : , , . " ", ( 64 ) XOR , " ".

, ++ 0x, ABI, Garbage Collection. n3225 20.9.11 [util.dynamic.safety]. , , :

void declare_reachable(void* p); // throw std::bad_alloc
template <typename T> T* undeclare_reachable(T* p) noexcept;

void declare_no_pointers(char* p, size_t n) noexcept;
void undeclare_no_pointers(char* p, size_t n) noexcept;

pointer_safety get_pointer_safety() noexcept;

( ) . , , , , . new delete, ...

, : ( ) Mark And Sweep - , ( , / ,...).

+1

, , , Mozilla Firefox , , , , . , , .

, C++, , , , . , - , , . , , , , .

, ++ , . (, GC Boehm), .

+1

All Articles