chaoyli opened a new pull request #2899: [gutil] import scoped_refptr smart 
pointer from KUDU
URL: https://github.com/apache/incubator-doris/pull/2899
 
 
   scoped_refptr is used to replace std::shared_ptr, is generally faster and 
smaller.
   advantage
     (1) only requires a single allocation, and ref count is on the same cache 
line as the object
     (2) the pointer only requires 8 bytes (since the ref count is within the 
object)
     (3) you can manually increase or decrease reference counts when more 
control is required
     (4) you can convert from a raw pointer back to a scoped_refptr safely 
without worrying about double freeing
     (5) since we control the implementation, we can implement features, such 
as debug builds that capture the stack trace of every referent to help debug 
leaks.
   disadvantage
     (1) the referred-to object must inherit from RefCounted
     (2) does not support the weak_ptr use cases

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to