You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/01/05 16:06:50 UTC
[GitHub] [incubator-doris] HappenLee commented on a change in pull request #7567: [vectorized][refactor](common) eliminate class COW dependence on boost
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org