chenBright opened a new pull request, #3447:
URL: https://github.com/apache/brpc/pull/3447

   ### What problem does this PR solve?
   
   Issue Number: resolve 
   
   Problem Summary:
   
   `brpc_controller_unittest` fails under LeakSanitizer/ASan with reports like:
   
   ```
   ==ERROR: LeakSanitizer: detected memory leaks
   Direct leak ... in brpc::Span::CreateClientSpan(...) src/brpc/span.cpp:208
   SUMMARY: AddressSanitizer: 110 byte(s) leaked in 4 allocation(s).
   ```
   
   `Span` objects are recycled through `butil::object_pool` and are never truly
   freed; `SpanDeleter` returns them to the pool instead of releasing them. As a
   result, the `shared_ptr` control block, the `_full_method_name` string, and 
the
   pooled `Span` itself are kept alive by the pool by design. LeakSanitizer 
cannot
   follow the pointers held inside the pool and therefore reports these 
intentional
   retentions as leaks.
   
   ### What is changed and the side effects?
   
   Changed:
   
   Add `ANNOTATE_SCOPED_MEMORY_LEAK` at the entry of the span factory functions
   that allocate through the object pool, so LeakSanitizer ignores these 
intentional retentions:
     - `Span::CreateClientSpan`
     - `Span::CreateBthreadSpan`
     - `Span::CreateServerSpan` (the overload that performs the allocation)
   
   This reuses the existing suppression mechanism already used in 
`Server::InitializeOnce` 
   for `_keytable_pool`.
   
   Side effects:
   - Performance effects:
   
   - Breaking backward compatibility: 
   
   ---
   ### Check List:
   - Please make sure your changes are compilable.
   - When providing us with a new feature, it is best to add related tests.
   - Please follow [Contributor Covenant Code of 
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
   


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