> ## Documentation Index
> Fetch the complete documentation index at: https://docs.proofpod.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CPU, memory and timeouts

> Limits are ceilings, not reservations: you pay for what a command uses.

```console theme={null}
$ pp --cpu 16 --memory 64G --timeout 4h lake build
```

| Option | Default | Range | Meaning |
| - | - | - | - |
| `--cpu CORES` | `4` | 0.125 – 32 | Most physical cores the command may use. |
| `--memory SIZE` | `16G` | 512M – 128G | Most memory the command may allocate. |
| `--timeout DURATION` | `1h` | 1s – 24h | The command is stopped after this long. |

Set them per project in [`proofpod.toml`](https://docs.proofpod.dev/reference/config), or per shell
with `PROOFPOD_CPU`, `PROOFPOD_MEMORY` and `PROOFPOD_TIMEOUT`.

## Limits are not reservations

`--cpu` and `--memory` are **ceilings**. You are billed for what the command
uses underneath them, per second, and nothing for the headroom.

This matters for Lean because its resource use is very uneven. Elaborating one
file uses one core. `lake build` uses as many cores as there are modules ready
to compile, which is many at the start of a build and one at the end of a
dependency chain. Paying for a 16-core reservation through the single-threaded
parts is most of what makes cloud builds expensive. Here you do not.

The trade-off: cores are not reserved either. A command can always use its
limit when the hardware has it free, which is the normal case, but sixteen
cores are not held idle on your behalf while your command uses one.

## CPU

A core is a physical core, equivalent to two vCPUs on most clouds. The sandbox
reports your limit as its CPU count, so Lake's default parallelism matches
`--cpu` without any extra flags.

## Memory

`SIZE` is binary: `16G` means 16 GiB. `M`, `G`, `GiB` and so on are accepted; a
bare number is MiB.

The limit applies to memory your command **allocates**. Compiled libraries that
Lean memory-maps do not count, toward the limit or the bill. Importing all of
Mathlib maps about 8 GB of `.olean` files; with ProofPod that is free and does
not eat into `--memory`. A file that imports all of Mathlib and proves a few
lemmas allocates a few hundred megabytes.

If a command allocates more than the limit it is stopped:

```console theme={null}
proofpod: error: out of memory: the command exceeded 16 GiB. Retry with a larger --memory.
```

The exit code is 137, the same as a process killed by the kernel for running
out of memory.

## Timeouts

`DURATION` accepts `90` (seconds), `90s`, `30m`, `2h`, `1h30m` or `1d`. When the
timeout is reached the command receives `SIGTERM`, then `SIGKILL` five seconds
later, and `pp` exits with 124.

## Warm sandboxes

After a command finishes, its sandbox stays warm for two minutes. A command that
arrives in that window starts in about a second and finds file caches already
populated. You are not billed for warm time.

A sandbox is reused when the next command in the same workspace asks for the
same versions and the same `--cpu` and `--memory`. Changing any of those starts
a fresh sandbox, which is slower for the first command. If you alternate
between two sets of limits, put the larger one in `proofpod.toml` and use it
for everything: unused headroom is free.

Cold starts are noticeable for Mathlib projects: the first `lake build` in a new
sandbox spends 15 to 30 seconds reading Mathlib's build metadata before it
compiles anything. See [Troubleshooting](https://docs.proofpod.dev/guide/troubleshooting.md#performance).

## One command at a time per workspace

A workspace runs one command at a time. A second command started while the
first is still running waits for it:

```console theme={null}
proofpod: waiting for another command in this workspace to finish
```

This mirrors Lake, which takes a lock on the build directory, and it keeps the
usage meter attributable to one command. If the second command asks for
different limits or versions than the running one, it is refused rather than
queued; wait, or stop the first with `pp cancel`.

Different workspaces (different projects, or different machines) run
independently. An account can run 8 commands at once.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.