Python MemoryError in CI
Python raised MemoryError because an allocation exceeded available RAM. In CI this is common with data libraries (pandas, numpy) loading or copying large structures.
What this error means
A step ends with a traceback in MemoryError, often during a large read, concat, or array allocation. Using a larger runner or streaming the data clears a one-off spike with no logic change.
shell
Traceback (most recent call last):
File "etl.py", line 88, in <module>
df = pd.concat(frames)
MemoryErrorCommon causes
Loading more data than fits in RAM
Reading a large dataset fully into memory, or copying it, can exceed the runner ceiling.
An unbounded accumulation in the code
Building a list/array that grows without limit eventually exhausts memory; this is a code fix, not a runner fix.
How to fix it
Reduce peak memory
Process data in chunks instead of all at once.
shell
for chunk in pd.read_csv("big.csv", chunksize=100_000):
process(chunk)Right-size or rework
- Move data-heavy jobs to a runner with more RAM for a genuine one-off spike.
- If memory grows unboundedly, fix the accumulation in your code.
- Lower worker/process parallelism in the step.
How to prevent it
- Stream or chunk large datasets in CI.
- Right-size memory for data pipelines.
- Profile peak memory for data-heavy tests.
Related guides
CI Step "Killed" Exit Code 137 (OOM)Why CI steps exit with code 137 and "Killed": the OOM killer sent SIGKILL after the job exceeded runner memor…
Go "fatal error: runtime: out of memory" in CIFix "fatal error: runtime: out of memory" in Go CI when the runtime cannot get memory from the OS. How to red…
Jest Worker Ran Out of Memory in CIFix "Jest worker ran out of memory" in CI when too many workers or a leak exhausted RAM. How to lower workers…
Container Memory Limit Exceeded in CIFix a CI container killed for exceeding its memory limit (cgroup OOM, exit 137) even with free host RAM. How…