GrepBoard/Manuals
605 manuals ·

Gemini CLI "High memory usage detected" warning: what to do

·Tested on Gemini CLI 0.62.0 and main source · 2026-11·Test scope ↓·6 steps

Gemini CLI's High memory usage detected warning means the process passed 7 GiB. It shows once: save your work, then /compress, /clear and trim big PDFs.

text
⚠  High memory usage detected: 7.28 GB. If you experience a crash, please file a bug report by running /bug

This warning means the process running Gemini CLI is using more than 7 GiB (7,516,192,768 bytes) of memory. It is a warning, not an error, and your work continues. But if the session keeps growing it can end in JavaScript heap out of memory, so save what you have and shrink what the session is holding.

The text above is not reproduced output; it is quoted from the body of an issue opened on 2026-10-01 (including the two spaces after the symbol). The reporter (0.62.0, API-key login, gemini-3-flash-preview) fed two 80-slide PDFs and one Markdown file in; the model thought for about 18 minutes, hit the free-token limit and fell back to another model. After the warning appeared, the process died with JavaScript heap out of memory. The issue is still open as of 2026-11.

[1] Know what the warning measures. packages/cli/src/ui/hooks/useMemoryMonitor.ts in the repository reads process.memoryUsage().rss once a minute, and when it exceeds 7 × 1024³ bytes (7 GiB) it adds the message above to the screen once. After that it stops checking, so it does not appear twice in one session. The file at the v0.62.0 tag was identical to main. The "GB" in the message is computed as GiB, and what it measures is the whole process (RSS), not the heap.

[2] Protect your work first. The warning shows once, and the reporter's process died afterwards. If a long result is in progress, copy what you have to a file. Assume that when the process dies, the conversation held in memory is gone.

[3] Shrink the session context. Per the official commands doc, /compress replaces the entire chat context with a summary, and /clear clears the conversation context and starts a new session. Use /compress if you still need to continue, /clear if you can start over.

[4] Check whether you are feeding large PDFs directly. The reporter hit the warning with two 80-slide PDFs, wrote in a comment that adding 300 slides and 542 pages of PDF behaved the same, and said that converting the PDFs to Markdown noticeably eased the problem. That is the reporter's observation, not an official confirmation. An automated analysis comment on the issue guesses that PDFs stay in the conversation history as base64 strings and pile up; that was not checked against the code here. What you can do now is convert text-heavy PDFs to Markdown before attaching them, and avoid putting several large files into one session.

[5] Watch the number. The settings doc says ui.showMemoryUsage (default false) displays memory usage information in the UI. How it is displayed was not checked. For where settings files are read from, see Check where Gemini CLI settings.json is read.

[6] Know that the heap limit is a separate setting. The startup code (packages/cli/src/gemini.tsx) sets a target heap of 50% of total RAM when advanced.autoConfigureMemory is true (the default), and adds --max-old-space-size and relaunches only if the current limit is lower than that target. A higher existing limit is left alone, and the environment variable GEMINI_CLI_NO_RELAUNCH skips the relaunch. This comes from reading the code, not from measuring a machine, so how this warning line relates to the heap limit can differ from machine to machine. A higher limit may let a large job finish, but if the cause is memory that keeps accumulating, raising the limit leaves that cause in place, so do [3] and [4] first.

The /bug in the message is the bug-report command. When you add your case to the issue, include the version, login method, model, the kind and size of files you attached, and how long the session had run when the warning appeared.

#gemini-cli#memory#warning#troubleshooting