Why am I getting an out-of-memory error in my service?
Last updated: June 30, 2025
Context
Out of memory errors occur when your application attempts to use more memory than its allocated limits, causing the cluster to restart the service. This can happen due to improper load handling or memory leaks in your application, for example.
Answer
There are two approaches to addressing out-of-memory errors:
Temporary Solution
You can increase the memory allocation for your service:
Navigate to the Resources tab of your service
Increase the memory allocation for your application
Recommended Long-term Solution
While increasing resources provides immediate relief, it's not the most efficient long-term solution. Instead:
Profile your application to identify memory usage patterns
Analyze how your application behaves under different load conditions
Identify which processes consume the most resources
Fix any memory leaks in your code
Note: Out-of-memory errors can occur very quickly, so they might not always be visible in the Metrics tab due to metric sampling rates.