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

Don't count the region tracker page when checking for leaks #892

Merged
merged 1 commit into from
Nov 9, 2024
Merged
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
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