The shared_ptr in C++ uses _______ counting to manage the memory of shared objects.
- reference
- object
- allocation
- array
shared_ptr uses reference counting, which means it keeps a count of the number of shared_ptr objects referring to the same memory location. When this count drops to zero (meaning no shared pointers are referring to the object), the memory is automatically deallocated.
Loading...
Related Quiz
- Which of the following containers in the Standard Template Library (STL) allows duplicate elements and keeps them in sorted order?
- Which standard library provides predefined exception classes in C++?
- What does the term “Diamond Problem” refer to in the context of C++ inheritance?
- Which of the following data types has the smallest size in C++?
- Which parameter-passing method does not allow the function to modify the actual argument?