Skip to content

fix: correctly release buckets#456

Open
dkharms wants to merge 1 commit into
336-atomic-substitutefrom
0-cache-release-fix
Open

fix: correctly release buckets#456
dkharms wants to merge 1 commit into
336-atomic-substitutefrom
0-cache-release-fix

Conversation

@dkharms

@dkharms dkharms commented Jul 6, 2026

Copy link
Copy Markdown
Member

Description

One of the nastiest I've ever seen which leads to incorrect accounting of cache-owned memory.

With compaction enabled previous code could overwrite live buckets with other released (or live) buckets leading to x2 cache memory usage.

An example when we lose live buckets:

buckets = [A, B, C, D, E]; toDelete=[A, E]

After the ReleaseBuckets() we end up with buckets = [E, B, C] losing bucket D. This bucket will be eventually released because fraction (bucket's owner) is alive and will suicide (therefore calling Release()) but memory accounting will be broken.

Memory accounting will be broken because the generation bucket belongs to will be evicted therefore memory usage of this bucket will not be accounted.


  • I have read and followed all requirements in CONTRIBUTING.md;
  • I used LLM/AI assistance to make this pull request;

If you have used LLM/AI assistance please provide model name and full prompt:

Model: {{model-name}}
Prompt: {{prompt}}

@dkharms dkharms added the bug Something isn't working label Jul 6, 2026
@dkharms dkharms force-pushed the 336-atomic-substitute branch from 59284a4 to 46ab336 Compare July 7, 2026 10:04
@dkharms dkharms force-pushed the 0-cache-release-fix branch from a4a83a7 to 4790c59 Compare July 7, 2026 10:09
@dkharms dkharms added this to the v0.74.0 milestone Jul 8, 2026
@eguguchkin eguguchkin requested a review from cheb0 July 9, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working epic/compaction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants