Evian-Zhang commented on issue #10379:
URL: https://github.com/apache/arrow-rs/issues/10379#issuecomment-5465770803

   I have four approaches in mind:
   
   * Declare `shrink_to_fit` as unsafe, and requires the memory pool should not 
panic in the `SAFETY` requirement
   * Modify `Bytes::try_realloc` to accept a callback function, which will be 
invoked after the reallocating and before calling `self.resize_reservation()`
   * Before calling `Bytes::try_realloc`, let `self.ptr` point to a static 
valid memory buffer. If `try_realloc` succeeds, `self.ptr` will still be 
updated correctly; If it panics, at least there will be no memory-related 
issues.
   * Use drop guard, similarly, to let `self.ptr` point to a static valid 
memory buffer if panic happens.


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

Reply via email to