Container memory limit exceeded Google Cloud / Firebase Origin: Platform & cloud Last updated 4 Nov 2026

Cloud Run: Memory limit of 512 MiB exceeded with 530 MiB used. Consider increasing the memory limit

The container used more memory than the Cloud Run service allows, so the instance was terminated.

Exact message you may see Memory limit of 512 MiB exceeded with 530 MiB usedConsider increasing the memory limitContainer terminated on signal 9 Cloud RunMemory limit exceeded Cloud RunMemory limit of 256 MiB exceeded
Seen on: Google Cloud

Meaning

Memory includes the app, in-memory files (Cloud Run's filesystem is in-memory) and every concurrent request. Raise --memory, lower --concurrency, stream files instead of buffering, and avoid writing large temp files to the container filesystem.

Common causes

  • Default 512 MiB too small for the app
  • High concurrency multiplying per-request memory
  • Large files buffered in RAM or written to /tmp
  • Memory leak
  • Language runtime defaults (JVM, Node heap)

⚡ Quick fix

  1. gcloud run services update SERVICE --memory 1Gi
  2. Reduce --concurrency
  3. Stream uploads/downloads and use Cloud Storage for large files

Detailed fix by platform

gcloud

  1. gcloud run services update SERVICE --memory 2Gi --concurrency 20 --region REGION

How to diagnose

  1. Usage — Peak vs limit?
  2. Files — /tmp usage?
  3. Concurrency — Per-request memory?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

API has not been used in project before or it is disabled — Google Cloud: 403 SERVICE_DISABLED — Cloud Resource Manager API has not been used in project 123456 before or it is disabled. Enable it by visiting (Google Cloud / Firebase)API has not been used…Cloud Run 403: Your client does not have permission to get URL — Cloud Run: Error: Forbidden — Your client does not have permission to get URL / from this server (Google Cloud / Firebase)Cloud Run 403: Your c…Cloud Run 503: The request failed because the instance had an error — Cloud Run: 503 Service Unavailable — The request was aborted because there was no available instance (Google Cloud / Firebase)Cloud Run 503: The re…Cloud Run 504: The request has been terminated because it has reached the maximum request timeout — Cloud Run: 504 Gateway Timeout — The request has been terminated because it has reached the maximum request timeout (Google Cloud / Firebase)Cloud Run 504: The re…Cloud Run: Image not found / failed to pull — Cloud Run: Revision 'svc-00005' is not ready — Image 'gcr.io/proj/app:latest' not found / Permission 'artifactregistry.repositories.downloadArtifacts' denied (Google Cloud / Firebase)Cloud Run: Image not …Container exceeded memory limit — Bitbucket Pipelines: Container 'Build' exceeded memory limit / Docker container exited with code 137 (CI/CD)Container exceeded me…Gradle Java heap space — Gradle: Expiring Daemon because JVM heap space is exhausted / java.lang.OutOfMemoryError: Java heap space during build (Android)Gradle Java heap spaceheap out of memory — FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory (Node.js)heap out of memoryContainer…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.