Jefffrey commented on issue #5352:
URL: https://github.com/apache/arrow-rs/issues/5352#issuecomment-1918802135

   I think this PR might help clear up confusion, as it enhances the docstring 
of `get_buffer_memory_size()`: https://github.com/apache/arrow-rs/pull/5347
   
   ```rust
       /// Note that this does not always correspond to the exact memory usage 
of an array,
       /// since multiple arrays can share the same buffers or slices thereof.
   ```
   
   Note that `value_data().len()` gives the len, i.e. how many bytes are used 
in the buffer, whilst `get_buffer_memory_size()` calculates using the capacity 
of the buffer (how much memory is allocated to it), which might be larger than 
the len:
   
   
https://github.com/apache/arrow-rs/blob/31cf5ce23febf076104f064358a24fe8af09ee4b/arrow-array/src/array/byte_array.rs#L464-L471
   
   This should help explain the discrepancy.


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