From 68f80610ea127c2ee28a1aa83130727bcbeba9fb Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Tue, 2 Nov 2021 19:48:12 +0000 Subject: [PATCH] ARROW-14559: [C++] reduce memory usage in GcsFileSystem::OpenInputStream --- cpp/src/arrow/filesystem/gcsfs.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/filesystem/gcsfs.cc b/cpp/src/arrow/filesystem/gcsfs.cc index beb6c0a89ef..73d599fffa5 100644 --- a/cpp/src/arrow/filesystem/gcsfs.cc +++ b/cpp/src/arrow/filesystem/gcsfs.cc @@ -95,7 +95,8 @@ class GcsInputStream : public arrow::io::InputStream { if (!stream_.status().ok()) { return internal::ToArrowStatus(stream_.status()); } - return arrow::SliceMutableBufferSafe(std::move(buffer), 0, stream_.gcount()); + RETURN_NOT_OK(buffer->Resize(stream_.gcount(), true)); + return buffer; } private: