gemini-cli - 💡(How to fix) Fix Too much memory used [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25762Fetched 2026-04-22 08:03:23
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
labeled ×1

Error Message

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

RAW_BUFFERClick to expand / collapse

What happened?

after porcessing a bathces of photos I see this after a while

<--- Last few GCs --->

[3035:0x7746000] 3627917 ms: Scavenge 7286.3 (7323.0) -> 7284.9 (7292.0) MB, pooled: 31 MB, 2.15 / 0.00 ms (average mu = 0.999, current mu = 1.000) allocation failure; [3035:0x7746000] 3631784 ms: Mark-Compact 7987.4 (7994.6) -> 7974.4 (7992.6) MB, pooled: 33 MB, 36.34 / 0.06 ms (average mu = 0.999, current mu = 1.000) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace -----

1: 0xe42d60 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 2: 0x121ddd0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 3: 0x121e0a7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 4: 0x144ba05 [/home/art/.nvm/versions/node/v22.22.1/bin/node] 5: 0x1465299 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 6: 0x1439948 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 7: 0x143a875 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 8: 0x1412c6e v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 9: 0x1401d64 v8::internal::FactoryBasev8::internal::Factory::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Taggedv8::internal::Map, v8::internal::AllocationAlignment) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 10: 0x1403c6f v8::internal::FactoryBasev8::internal::Factory::NewRawTwoByteString(int, v8::internal::AllocationType) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 11: 0x14283c7 v8::internal::Factory::NewStringFromTwoByte(v8::base::Vector<unsigned short const>, v8::internal::AllocationType) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 12: 0x158ff06 v8::internal::JsonStringifier::Stringify(v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 13: 0x158fff4 v8::internal::JsonStringify(v8::internal::Isolate*, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 14: 0x129b3f2 v8::internal::Builtin_JsonStringify(int, unsigned long*, v8::internal::Isolate*) [/home/art/.nvm/versions/node/v22.22.1/bin/node] 15: 0x712a22e6c3b6

What did you expect to happen?

Not to crash

Client information

  • CLI Version: 0.38.2
  • Git Commit: b0ed611a0
  • Session ID: 1bf831d6-174f-4a86-92b4-1d2c22429ead
  • Operating System: linux v22.22.1
  • Sandbox Environment: no sandbox
  • Model Version: auto-gemini-3
  • Auth Type: oauth-personal
  • Memory Usage: 3.32 GB
  • Terminal Name: Unknown
  • Terminal Background: #282c34
  • Kitty Keyboard Protocol: Unsupported

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

Increase the Node.js heap size to prevent the JavaScript heap out of memory error.

Guidance

  • The error message "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory" indicates that the Node.js process has run out of memory.
  • To fix this, you can try increasing the heap size by running your Node.js process with the --max-old-space-size flag, for example: node --max-old-space-size=4096 your_script.js to set the heap size to 4GB.
  • You can also try to optimize your code to use less memory, for example by processing the photos in smaller batches or by releasing any unnecessary memory allocations.
  • Monitor your memory usage to determine the optimal heap size for your application.

Example

node --max-old-space-size=4096 your_script.js

Notes

  • Increasing the heap size will only temporarily solve the problem if your code has a memory leak. You should investigate and fix any memory leaks in your code to prevent this error from happening again.
  • The optimal heap size will depend on the specific requirements of your application and the available memory on your system.

Recommendation

Apply workaround: Increase the Node.js heap size using the --max-old-space-size flag. This will allow your application to use more memory and prevent the JavaScript heap out of memory error. However, you should also investigate and fix any memory leaks in your code to prevent this error from happening again.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - 💡(How to fix) Fix Too much memory used [1 participants]