Skip to content

Fix Plugin SDK declaration build memory spikes - #2771

Open
MacHatter1 wants to merge 1 commit into
get-bb:mainfrom
MacHatter1:fix/plugin-sdk-build-memory-cap
Open

Fix Plugin SDK declaration build memory spikes#2771
MacHatter1 wants to merge 1 commit into
get-bb:mainfrom
MacHatter1:fix/plugin-sdk-build-memory-cap

Conversation

@MacHatter1

Copy link
Copy Markdown

Human comments

What was wrong

The Plugin SDK declaration bundler sized its worker pool only from available CPU parallelism. When separate forced Turbo graphs ran concurrently, each graph rebuilt the shared declaration task and each build spawned a full worker pool. Every worker creates an independent Rollup/TypeScript declaration program, so the duplicated pools multiplied memory use until Node processes were killed for running out of memory.

What changed

  • Size the declaration worker pool from bundle count, available CPU parallelism, and physical memory, budgeting one worker per 8 GiB.
  • Cover the adaptive calculation for machines with different CPU and memory capacities.
  • Tell agents to combine package filters into one Turbo invocation instead of launching overlapping forced graphs.
  • No host-daemon wire, CLI, or Plugin SDK API change.

How you verified

  • Confirmed the new adaptive test failed against the fixed worker-count implementation: a 12-core, 24 GiB host returned 2 instead of 3.
  • pnpm exec turbo run test typecheck --filter=@get-bb/plugin-sdk --force — passed 6/6 tasks, 23 test files, and 222 tests.
  • pnpm exec oxfmt --check AGENTS.md packages/plugin-sdk/scripts/build-bundled-dts.mjs packages/plugin-sdk/scripts/build-bundled-dts-concurrency.mjs packages/plugin-sdk/scripts/build-bundled-dts-concurrency.test.mjs — passed.
  • git diff --check — passed.
  • Live host calculation: 12 available workers and 24 GiB physical memory select 3 declaration workers.

Fixes: N/A

AGENT GENERATED

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.

1 participant