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

   @lorinlee 可以的。
   
   但旧接口会导致很多误解。
   比如ut中AddChannel用法,假设 NCHANS = 0,就会直接泄漏资源。
   
https://github.com/apache/brpc/blob/dc9e786fbb5fd79f08b49fa8d55ec4e1a35f2125/test/brpc_channel_unittest.cpp#L634C18-L634C26
   
   也有很多代码写了
   brpc::ResponseMerger* merger =  new XXResponseMerger(); 
   将 merger传入AddChannel;
   
   如果AddChannel失败,就会泄漏资源;
   其次在很多业务会 new CallMapper,new ResponseMerger 后执行一堆操作,而AddChannel 
可有可能后续不再调用,就会有潜在泄漏问题。
   
   使用新接口必须用 intrusive_ptr 管理及传递,就可以避免这种潜在问题。


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