fix: size estimates (#4950)
* fix: `Tombstone::size` must include serialized predicate * fix: `CachedPartition::size` must include `Arc` heap allocation Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>pull/24376/head
parent
1a74f84494
commit
9b8086df74
|
@ -799,8 +799,7 @@ pub struct Tombstone {
|
||||||
impl Tombstone {
|
impl Tombstone {
|
||||||
/// Estimate the memory consumption of this object and its contents
|
/// Estimate the memory consumption of this object and its contents
|
||||||
pub fn size(&self) -> usize {
|
pub fn size(&self) -> usize {
|
||||||
// No additional heap allocations
|
std::mem::size_of_val(self) + self.serialized_predicate.capacity()
|
||||||
std::mem::size_of_val(self)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,9 @@ struct CachedPartition {
|
||||||
impl CachedPartition {
|
impl CachedPartition {
|
||||||
/// RAM-bytes EXCLUDING `self`.
|
/// RAM-bytes EXCLUDING `self`.
|
||||||
fn size(&self) -> usize {
|
fn size(&self) -> usize {
|
||||||
|
// Arc heap allocation
|
||||||
|
size_of_val(self.sort_key.as_ref()) +
|
||||||
|
// Arc content
|
||||||
self.sort_key
|
self.sort_key
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
|
@ -275,8 +275,8 @@ mod tests {
|
||||||
|
|
||||||
let cache = make_cache(&catalog);
|
let cache = make_cache(&catalog);
|
||||||
|
|
||||||
let single_tombstone_size = 96;
|
let single_tombstone_size = 101;
|
||||||
let two_tombstone_size = 176;
|
let two_tombstone_size = 186;
|
||||||
assert!(single_tombstone_size < two_tombstone_size);
|
assert!(single_tombstone_size < two_tombstone_size);
|
||||||
|
|
||||||
// Create tombstone 1
|
// Create tombstone 1
|
||||||
|
|
Loading…
Reference in New Issue