Skip to content

Fix duplicate typed-array buffer release - #10609

Merged
chrisgervang merged 2 commits into
masterfrom
codex/attribute-delete-idempotent
Aug 30, 2026
Merged

Fix duplicate typed-array buffer release#10609
chrisgervang merged 2 commits into
masterfrom
codex/attribute-delete-idempotent

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Stack position: Merged core prerequisite below #10607. It was squash-merged into master as 99a5aea70c; #10607 has since synchronized current master through an append-only merge.

Goal

Make attribute cleanup idempotent so a deleted attribute cannot return the same CPU buffer to the global typed-array pool twice.

Changes

  • Clear DataColumn.state.allocatedValue immediately after releasing it.
  • Cover repeated deletion explicitly.
  • Delete each shared update-buffer test attribute only after its parameter matrix has completed.

Benchmark results

No draw-time benchmark applies: delete() is a teardown path and this PR intentionally does not change rendering or steady-state layer updates. The measured benefit is correctness: repeated deletion no longer releases the same pooled typed array twice, preventing aliasing between later attribute allocations.

Validation

  • yarn vitest run --project headless test/modules/core/lib/attribute/attribute.spec.ts — 33/33 passed.
  • Coverage-mode deck + attribute + PathStyle regression sequence — 67/67 passed, with three intentional backend skips.
  • yarn biome check modules/core/src/lib/attribute/data-column.ts test/modules/core/lib/attribute/attribute.spec.ts.
  • yarn tsc --noEmit -p modules/core/tsconfig.json.
  • Required GitHub test matrix, Cursor Bugbot, and Greptile are green.

Note

Low Risk
Teardown-only change in attribute cleanup with no steady-state rendering impact; risk is limited to incorrect double-release behavior that this PR fixes.

Overview
DataColumn.delete() now clears state.allocatedValue right after returning the CPU typed array to the global pool, so a second delete() cannot release the same backing buffer twice and cause later attribute allocations to alias pooled memory.

Tests use allocate(4) instead of setData for the delete case, assert that allocatedValue is cleared (including after a repeated delete), and tear down shared updateBuffer fixtures once per test case after all parameter variants run.

Reviewed by Cursor Bugbot for commit bba16a2. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes typed-array cleanup idempotent by clearing the owned allocation reference immediately after release.

  • Adds repeated-deletion regression coverage.
  • Adjusts shared update-buffer tests so attributes are deleted after their parameter matrix completes.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
modules/core/src/lib/attribute/data-column.ts Clears allocatedValue after returning it to the typed-array pool, preventing repeated deletion from releasing the same allocation twice.
test/modules/core/lib/attribute/attribute.spec.ts Covers idempotent deletion and keeps shared test attributes alive until all update-buffer parameter cases finish.

Reviews (2): Last reviewed commit: "Merge branch 'master' into codex/attribu..." | Re-trigger Greptile

@coveralls

coveralls commented Aug 29, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 82.23% (-0.01%) from 82.24% — codex/attribute-delete-idempotent into master

@chrisgervang
chrisgervang merged commit 99a5aea into master Aug 30, 2026
6 checks passed
@chrisgervang
chrisgervang deleted the codex/attribute-delete-idempotent branch August 30, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants