← n8n Sizer
independent community tool

n8n “memory” means two different things

Half the people searching this want their AI agent to stop forgetting the conversation. The other half have a server that keeps crashing. These are unrelated problems — pick yours.

problem A · chat memory
My AI Agent forgets the conversation
It answers each message like it’s the first one. LangChain memory nodes, session keys, queue-mode traps.
problem B · server RAM
n8n crashes / out of memory
OOM kills, “JavaScript heap out of memory”, random restarts under load. 3-question checker below.

A · The agent forgets: it's not your server's RAM

Adding server RAM won’t fix this. Chat memory in n8n is a workflow-level feature: the AI Agent only remembers what a memory node feeds back into the prompt. The three usual causes:

SymptomCauseFix
Forgets between messagesNo memory node, or each run gets a new sessionAttach a memory node and pass a stable session key (e.g. the chat/user id) — not a random or empty one
Forgets after restart or randomly in productionSimple Memory lives in the n8n process RAM — a restart wipes it; in queue mode each worker has its own copy, so runs land on different memoriesUse persistent chat memory: Redis Chat Memory or Postgres Chat Memory node — mandatory in queue mode (per n8n docs)
Remembers only the last few messagesContext window limit of the memory node / modelRaise the window length consciously — every remembered message is re-sent as prompt tokens and costs money

Source: n8n docs on Simple Memory (“not shared between workers in queue mode”) — that queue caveat is the single most common production surprise.

B · n8n crashes: 3-question OOM checker

Answer three questions — get a diagnosis grounded in n8n's own benchmark and measured community reports, plus a copy-paste guard config.

Pin the heap. Node's default old-space often doesn't match your box, so it dies unpredictably instead of at a known line. Set NODE_OPTIONS=--max-old-space-size to ~60% of RAM (config below). On n8n 2.x also cap the task runners' heap separately.
Not sure the box is the right size at all? The sizing calculator turns your runs/day and peaks into RAM / vCPU / disk with sources — and generates the full docker-compose kit.

Your guard config

Caps the container and pins Node's heap so failures become graceful instead of random. Numbers are computed for the RAM you selected.

# Memory guard for n8n on a 2 GB box — paste into your docker-compose service
services:
  n8n:
    # hard cap: container dies cleanly at 1.5G instead of freezing the whole VPS
    mem_limit: 1.5g
    environment:
      # Node heap ≈60% of the box — n8n fails at a known line, not randomly
      - NODE_OPTIONS=--max-old-space-size=1229
      # n8n 2.x: task runners have their own heap — cap it separately
      - N8N_RUNNERS_MAX_OLD_SPACE_SIZE=307
      # stop hoarding successful runs in the DB (big RAM/disk saver):
      # - EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
# watch it live for a week and adjust: docker stats

Hitting memory limits on n8n Cloud?

Cloud plans don't let you touch memory settings — and community reports show AI Agent flows crashing on Cloud Starter that run clean on a self-hosted 8 GB box. If you're migrating to your own server, size it honestly first: our calculator turns your workload into RAM / vCPU / disk, a cost comparison, and a ready docker-compose kit.

Size my server →