kou commented on code in PR #39164:
URL: https://github.com/apache/arrow/pull/39164#discussion_r1429759390
##########
cpp/src/arrow/ipc/message.cc:
##########
@@ -626,10 +626,24 @@ class MessageDecoder::MessageDecoderImpl {
RETURN_NOT_OK(ConsumeMetadataLengthData(data,
next_required_size_));
break;
case State::METADATA: {
- auto buffer = std::make_shared<Buffer>(data, next_required_size_);
+ // We need to copy metadata because it's used in
+ // ConsumeBody(). ConsumeBody() may be called from another
+ // ConsumeData(). We can't assume that the given data for
+ // the current ConsumeData() call is still valid in the
+ // next ConsumeData() call. So we need to copy metadata
+ // here.
+ ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Buffer> buffer,
+ AllocateBuffer(next_required_size_, pool_));
+ memcpy(buffer->mutable_data(), data, next_required_size_);
Review Comment:
#39270 for memory manager.
--
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]