# Container terminated: Exit code 137 (Out of Memory)

- **ID:** `cloud/gcp-cloud-run-container-crash-oom`
- **Domain:** cloud
- **Category:** resource_error
- **Error Code:** `137`
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

Cloud Run container exceeds its allocated memory limit (default 512 MB), causing the kernel OOM killer to terminate the process.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Cloud Run (fully managed) | active | — | — |
| Cloud Run for Anthos | active | — | — |
| gcloud CLI 460.0.0 | active | — | — |

## Workarounds

1. **Increase the memory limit for the Cloud Run service: `gcloud run deploy <SERVICE> --memory=1Gi --region=us-central1`. Monitor memory usage via Cloud Monitoring and adjust accordingly. Also consider reducing concurrency: `gcloud run deploy <SERVICE> --concurrency=10` to limit simultaneous requests.** (85% success)
   ```
   Increase the memory limit for the Cloud Run service: `gcloud run deploy <SERVICE> --memory=1Gi --region=us-central1`. Monitor memory usage via Cloud Monitoring and adjust accordingly. Also consider reducing concurrency: `gcloud run deploy <SERVICE> --concurrency=10` to limit simultaneous requests.
   ```
2. **Profile the application to find memory-heavy operations. For Node.js, use `--max-old-space-size` flag in the Dockerfile: `CMD ["node", "--max-old-space-size=256", "app.js"]`. For Python, use `gc.set_threshold()` to tune garbage collection.** (75% success)
   ```
   Profile the application to find memory-heavy operations. For Node.js, use `--max-old-space-size` flag in the Dockerfile: `CMD ["node", "--max-old-space-size=256", "app.js"]`. For Python, use `gc.set_threshold()` to tune garbage collection.
   ```

## Dead Ends

- **** — Memory leaks continue to grow unbounded; the container will eventually hit the new limit too, wasting money. (85% fail)
- **** — The same container image with the same memory limit will crash again under the same load. (95% fail)
