chenBright commented on code in PR #3616:
URL: https://github.com/apache/brpc/pull/3616#discussion_r4301828762
##########
src/bvar/detail/percentile.h:
##########
@@ -129,7 +130,13 @@ class PercentileInterval {
const size_t num_remain_from_rhs = SAMPLE_SIZE - num_remain;
CHECK_LE(num_remain_from_rhs, rhs._num_samples);
// Have to copy data from rhs to shuffle since it's const
- DEFINE_SMALL_ARRAY(uint32_t, tmp, rhs._num_samples, 64);
+ uint32_t tmp_stack[64];
+ std::unique_ptr<uint32_t[]> tmp_heap;
+ uint32_t* tmp = tmp_stack;
+ if (rhs._num_samples > ARRAY_SIZE(tmp_stack)) {
+ tmp_heap.reset(new uint32_t[rhs._num_samples]);
+ tmp = tmp_heap.get();
+ }
Review Comment:
I think using DEFINE_SMALL_ARRAY is fine, so no changes are needed.
--
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]