Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Heuristic:FlowiseAI Flowise Heap Memory Configuration

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Optimization
Last Updated 2026-02-12 07:30 GMT

Overview

Memory optimization technique to prevent JavaScript heap out of memory errors during Flowise builds and production runtime.

Description

Flowise is a large TypeScript monorepo with many dependencies. The default Node.js heap size (1.5-2GB depending on platform) is insufficient for building the project or running in production with large chatflows. The `NODE_OPTIONS` environment variable must be set to increase the V8 heap limit. Docker containers use 8GB (`--max-old-space-size=8192`), while local builds require at least 4GB (`--max-old-space-size=4096`).

Usage

Use this heuristic when encountering Exit code 134 or JavaScript heap out of memory errors during `pnpm build` or at runtime with complex chatflows. This is a mandatory configuration for production deployments and Docker builds.

The Insight (Rule of Thumb)

  • Action: Set `NODE_OPTIONS` environment variable before building or running Flowise
  • Value: `--max-old-space-size=4096` for builds, `--max-old-space-size=8192` for production (Docker default)
  • Trade-off: Higher heap size consumes more system RAM; ensure the host has sufficient physical memory
  • Compatibility: Applies to all platforms (Linux, macOS, Windows)

Reasoning

The Flowise monorepo bundles approximately 190 npm dependencies in the components package alone, plus the server and UI packages. During the Turborepo build pipeline, TypeScript compilation and Vite bundling for all packages run in parallel, causing peak memory usage to exceed the default heap limit. In production, complex chatflows with many nodes and large document stores can also push memory usage beyond default limits. The 4GB build minimum and 8GB production target are empirically validated values from the Flowise team, documented in the Dockerfile and README troubleshooting section.

Code Evidence

Dockerfile production configuration at `Dockerfile:26`:

ENV NODE_OPTIONS=--max-old-space-size=8192

Worker Dockerfile at `docker/worker/Dockerfile:16`:

ENV NODE_OPTIONS=--max-old-space-size=8192

README troubleshooting at `README.md:127-138`:

Exit code 134 (JavaScript heap out of memory)

# macOS / Linux / Git Bash
export NODE_OPTIONS="--max-old-space-size=4096"

# Windows PowerShell
$env:NODE_OPTIONS="--max-old-space-size=4096"

# Windows CMD
set NODE_OPTIONS=--max-old-space-size=4096

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment