alamb commented on a change in pull request #505:
URL: https://github.com/apache/arrow-rs/pull/505#discussion_r660145714



##########
File path: arrow/src/array/data.rs
##########
@@ -354,12 +354,7 @@ impl ArrayData {
 
     /// Returns the total number of bytes of memory occupied physically by 
this [ArrayData].
     pub fn get_array_memory_size(&self) -> usize {
-        let mut size = 0;
-        // Calculate size of the fields that don't have 
[get_array_memory_size] method internally.
-        size += mem::size_of_val(self)
-            - mem::size_of_val(&self.buffers)

Review comment:
       since `child_data` and `null_bitmap` include the size of `self` in the 
results of `bitmap.get_array_memory_size()` and `child.get_array_memory_size()` 
I think we still need to subtract them off. 
   
   Perhaps a pattern such as *edited*
   
   ```rust
           if let Some(bitmap) = &self.null_bitmap {
               size += bitmap.get_array_memory_size()
               size -= mem::size_of_val(&bitmap);
           }
   ```
   would make the intent clearer




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to