Answer to the Question
There is no officially published upper bound for the Cairo prover’s memory usage. The prover’s footprint grows approximately linearly with the number of rows in the execution trace, multiplied by a factor that depends on the number of trace columns and the polynomial degree used in the STARK construction. The prover will abort with an out‑of‑memory error if it cannot allocate the required buffers; it does not truncate or compress the trace automatically.
How Memory Scales
Typical implementations (e.g., StarkWare’s Cairo prover) allocate a buffer for each polynomial and for the commitment scheme. A rough estimate is:
memory_footprint ≈ trace_length × num_columns × bytes_per_value
+ overhead_for_FFTs_and_batch_evaluations
Because the trace length is usually in the millions of rows, even a small per‑value cost can push the prover into the multi‑gigabyte range.
No Built‑in Cap or Truncation
The prover does not expose a hard limit switch that silently truncates the trace. Some prover builds allow a --max-memory or similar flag that will cause the process to exit when the limit is exceeded, but this is a soft cap – the prover will fail rather than continue with a shortened trace.
Practical Mitigations
- Reduce the number of trace columns by simplifying the Cairo program or using
#[starknet::contract] optimisations.
- Split the proving work into stages (pre‑commitment, partial proving) to keep peak memory lower.
- Configure the prover’s worker thread pool to balance CPU usage against memory pressure.
- Run the prover on a machine with more RAM or use a cloud instance with larger memory limits.
What to Do If You Hit OOM
When the prover exits with an out‑of‑memory message, gather the following details to help pinpoint the issue:
- The exact trace length (number of rows).
- The number of columns in the trace.
- The prover command line used (flags, environment variables).
With that information you can estimate the expected memory footprint and decide whether to adjust the program, the prover configuration, or the hardware.