diff --git a/src/ray/gcs/redis_context.cc b/src/ray/gcs/redis_context.cc index 1c339099c..08a4855df 100644 --- a/src/ray/gcs/redis_context.cc +++ b/src/ray/gcs/redis_context.cc @@ -113,7 +113,7 @@ void CallbackReply::ReadAsStringArray(std::vector *array) const { RAY_CHECK(!is_pubsub_reply) << "Subpub reply cannot be read as a string array."; } - array->resize(array_size); + array->reserve(array_size); for (size_t i = 0; i < array_size; ++i) { auto *entry = redis_reply_->element[i]; RAY_CHECK(REDIS_REPLY_STRING == entry->type) << "Unexcepted type: " << entry->type;