Skip to content

Commit

Permalink
always GC, but dont remove the last one
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Nov 8, 2023
1 parent 0164f56 commit fa66a63
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions crates/re_viewer/src/store_hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ impl StoreHub {
};

let store_dbs = &mut self.store_bundle.store_dbs;
if store_dbs.len() <= 1 {
return;
}

let Some(store_db) = store_dbs.get_mut(&store_id) else {
if cfg!(debug_assertions) {
Expand All @@ -239,9 +236,21 @@ impl StoreHub {
let store_size_after =
store_db.store().timeless_size_bytes() + store_db.store().temporal_size_bytes();

// No point keeping an empty recording around.
if store_db.is_empty() {
self.remove_recording_id(&store_id);
return;
}

// Running the GC didn't do anything.
// That's because all that's left in that store is protected rows: it's time to remove it entirely.
if store_size_before == store_size_after {
//
// That's because all that's left in that store is protected rows: it's time to remove it
// entirely, unless it's the last recording still standing, in case which we're better off
// keeping some data to show the user rather than a blank screen.
//
// If the user needs the memory for something else, they will get it back as soon as they
// log new things anyhow.
if store_size_before == store_size_after && store_dbs.len() > 1 {
self.remove_recording_id(&store_id);
}

Expand Down

0 comments on commit fa66a63

Please sign in to comment.