acquireStateLock was allocating a fresh SharedArrayBuffer on every retry iteration via Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), ...). The buffer is never mutated and never escapes, so hoisting it before the loop is a provably-equivalent transformation — Atomics.wait always sees value 0 whether the buffer is fresh or reused. Fixes #316 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
5
.changeset/316-state-lock-buffer-hoist.md
Normal file
5
.changeset/316-state-lock-buffer-hoist.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
type: Fixed
|
||||
pr: 316
|
||||
---
|
||||
acquireStateLock no longer allocates a fresh SharedArrayBuffer on every retry iteration — the sleep buffer is now hoisted before the retry loop and reused, eliminating per-retry heap pressure. (#316)
|
||||
Reference in New Issue
Block a user