Accepting the kindly advices from dear members (Rob, Andrey, Seth and others), I just updated the code with disposing version of rcgc_ptr (shared is removed to avoid misunderstandings) New added class is called rcgc_d_ptr. rcgc_ptr uses the dtor and would call the dtor multiple times of the reference object. rcgc_d_ptr needs the class to have a function named disposing() where all rcgc_d_ptr wrapped fields should call their .dispose() method (not ->dispose() method). class D { public: D() :_ptr_outC(){} ~D() { std::cout << "dtor for object of D:" << std::hex << this << std::endl; } public: void disposing() { //Should NOT be this->_ptr_outC->disposing() //which will lead to this function itself (direct/indirect-recursion). //NOTICE:Don't call self directly or indirectly! this->_ptr_outC.disposing(); } public: rcgc_d_ptr<C> _ptr_outC; }; And here is the GitHub address again in case you don’t get the last posts. https://github.com/yyl-20020115/RCGC