Troubleshooting
Low memory and out-of-memory crashes
Diagnose low-memory warnings, out-of-memory kills, and notebook kernel restarts.
What low memory means
Low memory means the project is close to its RAM limit. Out-of-memory means the Linux kernel killed a process because the project used more memory than the host allowed. In notebooks, this often looks like a kernel restart, missing output, or a cell that stops without finishing.
The limit is shared by everything running in the project: notebooks, terminals, language servers, background jobs, web apps, databases, and agents.
First things to try
- Open the project process or activity view and stop work you do not need.
- Restart the notebook kernel or terminal process that is using too much RAM.
- Shut down unneeded notebook kernels, terminal processes, and servers. Closing an editor or browser tab alone does not reliably free their backend memory.
- Load less data at once, stream data in chunks, or write intermediate results to files.
- Avoid keeping duplicate large arrays, dataframes, models, or images in memory.
For Python notebooks, clear variables you no longer need, restart the kernel after large experiments, and prefer chunked data tools when datasets approach the available RAM.
When the workload really needs more memory
Check the project's effective RAM limit and the host's available memory before changing a plan or moving work. On CoCalc AI, a private host's per-project cap and shared physical RAM differ from a shared-pool membership entitlement; see Host access and RAM. For repeated workloads, choose capacity with enough RAM and disk for the largest expected dataset and runtime image.
If the project is on a shared host, remember that other work on the same host can compete for memory. A dedicated host or larger host is more predictable for large research jobs, courses, or agent sandboxes.
Prevent repeat failures
Keep setup and data-processing steps reproducible so a killed process is not a lost result. Save intermediate files, checkpoint long calculations, and use scripts or notebooks that can restart from a durable point.
For agents, ask them to inspect memory usage before starting a large job and to prefer incremental processing when the input data is large.
Why this matters in CoCalc
CoCalc keeps notebooks and terminals durable, but it cannot make a process use less RAM than the host provides. Treat memory as part of the project environment: monitor it, size the host appropriately, and design workflows that can recover after a process is killed.