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.
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 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
gcloud run services update SERVICE --memory 1Gi- Reduce
--concurrency - Stream uploads/downloads and use Cloud Storage for large files
Detailed fix by platform
gcloud
gcloud run services update SERVICE --memory 2Gi --concurrency 20 --region REGION
How to diagnose
- Usage — Peak vs limit?
- Files — /tmp usage?
- 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:
Similar errors
- 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
- 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
- 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
Most viewed in Google Cloud / Firebase
- Missing or insufficient permissions Firestore: FirebaseError: [code=permission-denied]: Missing or insufficient permissions
- Container failed to start Cloud Run: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable
- Could not load the default credentials Google Cloud: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 4 Nov 2026