JkSelf commented on code in PR #10824:
URL: 
https://github.com/apache/incubator-gluten/pull/10824#discussion_r2425191583


##########
cpp/velox/operators/serializer/VeloxColumnarToRowConverter.cc:
##########
@@ -60,7 +60,8 @@ void 
VeloxColumnarToRowConverter::refreshStates(facebook::velox::RowVectorPtr ro
   if (nullptr == veloxBuffers_) {
     veloxBuffers_ = velox::AlignedBuffer::allocate<uint8_t>(totalMemorySize, 
veloxPool_.get());
   } else if (veloxBuffers_->capacity() < totalMemorySize) {
-    velox::AlignedBuffer::reallocate<uint8_t>(&veloxBuffers_, totalMemorySize);
+    veloxBuffers_.reset();

Review Comment:
   @zhouyuan The resource will be automatically released when the smart pointer 
is assigned a new value, as the assignment operator handles the reference 
counting internally. We can simplify the code to: 
   
   ```
   if (veloxBuffers_ == nullptr || veloxBuffers_->capacity() < totalMemorySize) 
{
       veloxBuffers_ = velox::AlignedBuffer::allocate<uint8_t>(totalMemorySize, 
veloxPool_.get());
   }
   ```



-- 
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]

Reply via email to