Skip to main content

๐Ÿง  Memory Tuning for Large Projects

All Early CLI agents generate code and run tests inside a Node.js process.
For large repositories or complex test suites, you may encounter:

FATAL ERROR: Ineffective mark-compacts near heap limit  
Allocation failed - JavaScript heap out of memory

To avoid this, tune Node.js memory via the NODE_OPTIONS environment variable.


Always set:

export NODE_OPTIONS="--max-old-space-size=5120"

This allocates ~5GB of heap memory โ€” enough for most monorepos and concurrent processing.

๐Ÿ“Œ You can set this once in your CI environment or inline per job.


๐Ÿงช GitHub Actions Exampleโ€‹

env:
NODE_OPTIONS: "--max-old-space-size=5120"

Set this at the job or step level.


๐Ÿงช Jenkins Exampleโ€‹

In your pipeline:

environment {
NODE_OPTIONS = '--max-old-space-size=5120'
}

Or as a shell export before invoking the CLI:

export NODE_OPTIONS="--max-old-space-size=5120"
early generate-pr

๐Ÿ“ˆ Memory Limits per CI Runnerโ€‹

CI PlatformRecommended MaxNotes
GitHub ubuntu-latest6000 MBDo not exceed --max-old-space-size=6000
Jenkins (medium agent)5120โ€“8192 MBBased on node resources
Self-hosted runners8192+ MBUse higher values with caution

โš ๏ธ Increasing memory allows more concurrency, but may slow down other jobs if the agent is underprovisioned.


๐Ÿ› ๏ธ Pro Tipโ€‹

Pair memory tuning with concurrency settings:

export NODE_OPTIONS="--max-old-space-size=5120"
export MAX_CONCURRENCY=4

See Concurrency & Performance for tuning recommendations.


โœ… Summaryโ€‹

VariableValue
NODE_OPTIONS--max-old-space-size=5120
LocationCI environment or step
Required?โš ๏ธ Optional, but strongly recommended