HappenLee commented on a change in pull request #7567:
URL: https://github.com/apache/incubator-doris/pull/7567#discussion_r778943297



##########
File path: be/src/vec/common/cow.h
##########
@@ -92,36 +93,158 @@
   *   to use std::unique_ptr for it somehow.
   */
 template <typename Derived>
-class COW : public boost::intrusive_ref_counter<Derived> {
-private:
+class COW {
+    std::atomic_uint ref_counter;
+
+protected:
+    COW() : ref_counter(0) {}
+
+    COW(COW const&) : ref_counter(0) {}
+
+    COW& operator=(COW const&) {
+        return *this;
+    }
+
+    unsigned int use_count() const {
+        return ref_counter.load();
+    }
+
+    void add_ref() {
+        ++ref_counter;
+    }
+
+    void release_ref() {

Review comment:
       Rethink here may cause mem leak? How boost::intrusive_ref_counter 
prevent the problem




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to