Commit fe94d95
fix: use value-only heap in OnDispose(Deleted) to prevent key-overflow double-subtract
OnDispose(Deleted) now uses GetValueHeapMemorySize() instead of
CalculateHeapMemorySize(). This prevents double-subtracting key overflow
bytes for immutable-region deletes where:
1. OnDispose(Deleted) fires on the source (subtracts full heap including key)
2. ClearHeapFields(clearKey=false) keeps key alive for chain traversal
3. Source is sealed (not tombstoned) — OnEvict visits it later
4. CalculateHeapMemorySize returns key overflow → subtracted again
With the fix:
- OnDispose(Deleted) subtracts value-only heap (value overflow + value object)
- For mutable deletes: tombstoned → OnEvict skips → key overflow is a bounded
phantom freed by GC when the page is freed (same as pre-IRecordTriggers)
- For immutable deletes: sealed → OnEvict visits → subtracts key overflow once
- Net: no double-decrement, bounded key-overflow phantom on mutable deletes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent f96ee7e commit fe94d95
1 file changed
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
0 commit comments