checkId: check.core.env.memory plugin: stellaops.doctor.core severity: warn tags: [quick, environment, resources]

Memory Usage

Doctor check check.core.env.memory — for operators watching a Stella Ops service’s working set so they can catch leaks and right-size limits before the runtime gets OOM-killed.

What It Checks

Verifies that the application process memory usage is within acceptable limits. The check reads the current process metrics and applies two thresholds:

ThresholdValue (Working Set)Result
Critical (fail)Greater than 2 GBfail
WarningGreater than 1 GBwarn
Healthy1 GB or lesspass

Evidence collected includes:

Why It Matters

Excessive memory usage leads to out-of-memory kills (OOM), especially in containerized deployments where memory limits are enforced. When a Stella Ops service is OOM-killed:

High Gen2 GC counts can also indicate a memory leak, where objects are promoted to the long-lived generation faster than they can be collected.

Common Causes

How to Fix

Docker Compose

Set memory limits for the service in docker-compose.yml:

services:
  platform:
    deploy:
      resources:
        limits:
          memory: 2G
        reservations:
          memory: 512M

Analyze memory usage:

# Check container memory stats
docker stats --no-stream <container>

# Capture a memory dump for analysis
docker compose exec <service> dotnet-dump collect -p 1

Bare Metal / systemd

Set memory limits in the systemd unit:

[Service]
MemoryMax=2G
MemoryHigh=1536M

Analyze memory:

# Install diagnostics tools
dotnet tool install -g dotnet-gcdump

# Capture GC dump
dotnet-gcdump collect -p <pid>

# Analyze with dotnet-dump
dotnet-dump analyze <dump-file>

Kubernetes / Helm

Set resource limits in Helm values:

resources:
  limits:
    memory: "2Gi"
  requests:
    memory: "512Mi"

Monitor memory:

kubectl top pods -l app=stellaops-platform

Verification

stella doctor run --check check.core.env.memory

See the Doctor reference for the full check catalog, CLI usage, and export bundles.