Rich-T-kid commented on code in PR #10317:
URL: https://github.com/apache/arrow-rs/pull/10317#discussion_r3584089126
##########
arrow-buffer/src/buffer/mutable.rs:
##########
@@ -140,13 +174,13 @@ impl MutableBuffer {
NonNull::new(raw_ptr).unwrap_or_else(||
handle_alloc_error(layout))
Review Comment:
good catch. The one way this could fail is if we OOM.
We could do something like this
```suggestion
let raw_ptr = unsafe { std::alloc::alloc(layout) };
if raw_ptr.is_null() {
return Err(MutableBufferError::OOM);
}
NonNull::new(raw_ptr).unwrap_or_else(||
handle_alloc_error(layout))
```
But I think `handle_alloc_error` already deals with this. I think running
out of memory is a condition where the program should panic.
We could bubble up the error to the caller but there aren't many things you
can do when your process runs out of memory, I'm sure it would be similar
handling to what `handle_alloc_error` already does. I don't have too strong of
an opinion either way, happy to try either approach.
--
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]