fix: full_reset/run 边界换新 Bump 替代原地 reset——旧 epoch/session arena 全量归还系统分配器、容量不跨 reset 保留,配 arena 保留锚校准用例

This commit is contained in:
2026-09-11 19:43:55 +00:00
parent abad859893
commit ad0405fe51
6 changed files with 119 additions and 9 deletions
+11
View File
@@ -27,6 +27,17 @@ fn epoch_reset_increments_id() {
assert_eq!(epoch.current_id(), 2);
}
/// 换新 Bump 后旧地址空间不复用:reset 边界双 arena 保留锚恰 0
/// (空 chunk 哨兵计 0),容量不跨 reset 保留。
#[test]
fn epoch_reset_frees_arena() {
let mut epoch = Epoch::new();
let _ptr = epoch.alloc(vec![0u8; 1 << 20]);
assert!(epoch.bump().allocated_bytes() > 0);
epoch.reset();
assert_eq!(epoch.bump().allocated_bytes(), 0);
}
#[test]
fn persistent_new_and_deref() {
let p = P::new(42i32);