MCPcopy Create free account
hub / github.com/apache/arrow-rs / get_array_memory_size

Method get_array_memory_size

arrow-data/src/data.rs:571–587  ·  view source on GitHub ↗

Returns the total number of bytes of memory occupied physically by this [`ArrayData`] and all its [`Buffer`]s and children. (See also diagram on [`ArrayData`]). Equivalent to: `size_of_val(self)` + [`Self::get_buffer_memory_size`] + `size_of_val(child)` for all children

(&self)

Source from the content-addressed store, hash-verified

569 /// [`Self::get_buffer_memory_size`] +
570 /// `size_of_val(child)` for all children
571 pub fn get_array_memory_size(&self) -> usize {
572 let mut size = mem::size_of_val(self);
573
574 // Calculate rest of the fields top down which contain actual data
575 for buffer in &self.buffers {
576 size += mem::size_of::<Buffer>();
577 size += buffer.capacity();
578 }
579 if let Some(nulls) = &self.nulls {
580 size += nulls.buffer().capacity();
581 }
582 for child in &self.child_data {
583 size += child.get_array_memory_size();
584 }
585
586 size
587 }
588
589 /// Creates a zero-copy slice of itself. This creates a new
590 /// [`ArrayData`] pointing at the same underlying [`Buffer`]s with a

Callers 6

bench_encodeFunction · 0.45
bench_roundtripFunction · 0.45
fake_flight_infoMethod · 0.45
bench_all_writersFunction · 0.45

Calls 2

capacityMethod · 0.45
bufferMethod · 0.45

Tested by 1

fake_flight_infoMethod · 0.36