sinomiko commented on issue #2466:
URL: https://github.com/apache/brpc/issues/2466#issuecomment-1859858176

   > 原有的接口,先声明两个 butil::intrusive_ptrbrpc::ResponseMerger 
rm_ptr(response_merger); butil::intrusive_ptr<XXXCallMapper> 
cm_ptr(call_mapper); 再用.get()传入指针,效果是不是一样的? 
channel.AddChannel(sub_channel.get(), brpc::DOESNT_OWN_CHANNEL, cm_ptr.get(), 
rm_ptr.get())
   
   一块资源给多个intrusive_ptr管理,会存在重复析构问题;
   如果使用 detach 
   
   channel.AddChannel(sub_channel.get(), brpc::DOESNT_OWN_CHANNEL, 
cm_ptr.detach(), rm_ptr.detach())
   
   又会存在AddChannel 失败,导致 资源泄漏问题。
   
   


-- 
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