Skip to content

Commit

Permalink
Don't count the region tracker page when checking for leaks
Browse files Browse the repository at this point in the history
We never shrink the region tracker page, so it'll show up as a leak any
time it grows larger than its initial size. This isn't a useful leak to
report, so just ignore it
  • Loading branch information
mconst committed Nov 8, 2024
1 parent 6e9a811 commit 033baee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fuzz/fuzz_targets/fuzz_redb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ fn exec_table_crash_support<T: Clone>(config: &FuzzConfig, apply: fn(WriteTransa
txn.commit().unwrap();
db.begin_write().unwrap().commit().unwrap();
let txn = db.begin_write().unwrap();
let baseline_allocated_pages = txn.stats().unwrap().allocated_pages();
let baseline_allocated_pages = txn.stats().unwrap().allocated_pages() - txn.num_region_tracker_pages();
txn.abort().unwrap();
countdown.store(old_countdown, Ordering::SeqCst);

Expand Down Expand Up @@ -686,7 +686,7 @@ fn exec_table_crash_support<T: Clone>(config: &FuzzConfig, apply: fn(WriteTransa
}

let txn = db.begin_write().unwrap();
let allocated_pages = txn.stats().unwrap().allocated_pages();
let allocated_pages = txn.stats().unwrap().allocated_pages() - txn.num_region_tracker_pages();
txn.abort().unwrap();
assert_eq!(allocated_pages, baseline_allocated_pages, "Found {} allocated pages at shutdown, expected {}", allocated_pages, baseline_allocated_pages);

Expand Down
5 changes: 5 additions & 0 deletions src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,11 @@ impl WriteTransaction {
})
}

#[cfg(any(test, fuzzing))]
pub fn num_region_tracker_pages(&self) -> u64 {
1 << self.mem.tracker_page().page_order
}

#[allow(dead_code)]
pub(crate) fn print_debug(&self) -> Result {
// Flush any pending updates to make sure we get the latest root
Expand Down

0 comments on commit 033baee

Please sign in to comment.