drin commented on issue #13978:
URL: https://github.com/apache/arrow/issues/13978#issuecomment-1227840682

   In the 1st reference ([api: 
arrow::Buffer](https://arrow.apache.org/docs/cpp/api/memory.html#_CPPv4N5arrow6BufferE)),
 it says that the base class doesn't, but **subclasses** often do:
   
   > The 
[Buffer](https://arrow.apache.org/docs/cpp/api/memory.html#classarrow_1_1_buffer)
 base class does not own its memory, but subclasses often do.
   
   In the 2nd reference ([api: 
io::Writable::Write](https://arrow.apache.org/docs/cpp/api/io.html#_CPPv4N5arrow2io8Writable5WriteERKNSt10shared_ptrI6BufferEE)),
 it sounds like it assumes a Buffer that does own its memory, though I admit it 
should be more precise:
   
   > Since the 
[Buffer](https://arrow.apache.org/docs/cpp/api/memory.html#classarrow_1_1_buffer)
 owns its memory, ...
   
   So, I looked to the implementation for 
[AllocateBuffer](https://github.com/apache/arrow/blob/07ac9fd86c6225f493943e4ab0ff35b0fdbfb2ae/cpp/src/arrow/memory_pool.cc#L876-L878)
 to cross reference my impression, and it returns a 
[PoolBuffer](https://github.com/apache/arrow/blob/07ac9fd86c6225f493943e4ab0ff35b0fdbfb2ae/cpp/src/arrow/memory_pool.cc#L778).
   
   I think the answer to your first question is that most functions returning a 
Buffer probably return a subclass that owns its memory and the base class does 
not explicitly require the memory be owned (so a subclass that doesn't want to 
could be written).


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