Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: overestimating memory size in buffer #6438

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions arrow-array/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,17 +1026,6 @@ mod tests {
);
}

#[test]
fn test_memory_size_primitive_sliced() {
let arr = PrimitiveArray::<Int64Type>::from_iter_values(0..128);
let slice1 = arr.slice(0, 64);
let slice2 = arr.slice(64, 64);

// both slices report the full buffer memory usage, even though the buffers are shared
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because current slice1 and sclic2 not return full buffer memory usage, so delete it.

assert_eq!(slice1.get_array_memory_size(), arr.get_array_memory_size());
assert_eq!(slice2.get_array_memory_size(), arr.get_array_memory_size());
}

#[test]
fn test_memory_size_primitive_nullable() {
let arr: PrimitiveArray<Int64Type> = (0..128)
Expand Down
2 changes: 1 addition & 1 deletion arrow-buffer/src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl Buffer {
/// For externally owned buffers, this returns zero
#[inline]
pub fn capacity(&self) -> usize {
self.data.capacity()
self.length + self.data.capacity() - self.data.len()
}

/// Returns whether the buffer is empty.
Expand Down
Loading