aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/client.h
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2016-11-03 11:41:19 -0700
committerGravatar Vijay Pai <vpai@google.com>2016-11-04 07:51:24 -0700
commit90102c2bfcf98f842f66567c67cbccbd0ede1d2b (patch)
tree8870307237865adcfdb167b5b98fee44b93cfcb8 /test/cpp/qps/client.h
parent852c58e8ae64ccd7361ab0bdc36f3297960c9d5b (diff)
Eliminate unnecessary uses of new[]/delete[] that can be replaced
with vector Also start eliminating uses of plain-old delete that are not helpful
Diffstat (limited to 'test/cpp/qps/client.h')
-rw-r--r--test/cpp/qps/client.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index a8d125ad28..56bfa9fee1 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -163,10 +163,9 @@ class Client {
MaybeStartRequests();
- // avoid std::vector for old compilers that expect a copy constructor
if (reset) {
- Histogram* to_merge = new Histogram[threads_.size()];
- StatusHistogram* to_merge_status = new StatusHistogram[threads_.size()];
+ std::vector<Histogram> to_merge(threads_.size());
+ std::vector<StatusHistogram> to_merge_status(threads_.size());
for (size_t i = 0; i < threads_.size(); i++) {
threads_[i]->BeginSwap(&to_merge[i], &to_merge_status[i]);
@@ -177,8 +176,6 @@ class Client {
latencies.Merge(to_merge[i]);
MergeStatusHistogram(to_merge_status[i], &statuses);
}
- delete[] to_merge;
- delete[] to_merge_status;
timer_result = timer->Mark();
} else {
// merge snapshots of each thread histogram