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

# Resize a Computer's Memory

> Increase running Computer Memory live when supported, shrink through Stop → Resize → Start, and verify Account CPU and guest memory.

Computer **Resize** updates a Computer's configured Memory (`ram_mib`) in **256 MiB increments** (minimum 256 MiB). Resize never changes the Account's `shared_cpus` entitlement or disk geometry, and **Sandbox Resize does not exist** (Sandbox Memory is fixed at creation).

Running growth within the current boot ceiling can complete **live**. Running shrink—or growth beyond the current boot ceiling—returns `restart_required` and leaves the Computer untouched until you explicitly run **Stop → Resize → Start**.

## When to resize

Increase Memory when builds, dependency installs, or Chromium need more working RAM and the Account pool has capacity. Before growing Memory for a slow task, verify it isn't actually bound by shared Account CPU (`shared_cpus`), network Fair Use, or Account Storage (`storage_status`).

Shrink when the workload fits smaller Memory and an interruption is acceptable—save application state first. In the Console, open **Settings → Configuration → Memory** and click **Save settings** (running shrink is disabled in the Console until you **Stop** first).

## Inspect state and request Resize

```js theme={null}
import { Deepest } from "@deepest/sdk";

const deepest = new Deepest({
  baseUrl: process.env.DEEPEST_API_URL,
  apiKey: process.env.DEEPEST_API_KEY,
});
const computer = deepest.computer(process.env.DEEPEST_COMPUTER_ID);

const targetMiB = Number(process.env.DEEPEST_TARGET_RAM_MIB);
if (!Number.isInteger(targetMiB) || targetMiB < 256 || targetMiB % 256 !== 0) {
  throw new Error("Target Memory must be a 256 MiB multiple (>= 256 MiB).");
}

const reply = await computer.resize({ ram_mib: targetMiB });
if (!reply.ok) throw new Error(`${reply.error.code} (${reply.retry})`);

console.log(reply.result.disposition, reply.result.computer.ram_mib);
```

Always inspect **both** `result.disposition` and `result.computer.ram_mib`—an HTTP 200 response with `restart_required` means the requested size was **not** applied yet:

| Disposition | Meaning | Next action |
| - | - | - |
| `live` | Running Computer accepted the target (guest attachment may converge asynchronously) | Re-read Computer, Resources, and guest `/proc/meminfo` |
| `next_start` | Stopped Computer configuration saved; occupies 0 running Memory until Start | Explicitly Start the same ID when pool capacity permits |
| `restart_required` | Running target was rejected without modifying or restarting the Computer (e.g. shrink or exceeding boot ceiling) | Save work, explicitly Stop, Resize while stopped (`next_start`), and Start |

> [!NOTE]
>
> Upgrading an Account plan does not automatically raise an already-running Computer's boot ceiling or change its vCPUs mid-flight—an explicit stopped Resize + cold Start applies the current Account configuration.

## Verify live growth vs. stopped Resize

> [tab] Verify live growth
>
> Check kernel boot ID and `/proc/meminfo` before and after a `live` resize:
>
> ```js theme={null}
> const probe = {
>   command: "sh",
>   args: ["-lc", "cat /proc/sys/kernel/random/boot_id; awk '/MemTotal/ {print}' /proc/meminfo"],
>   timeout_ms: 10000,
> };
> const after = await computer.exec(probe);
> if (!after.ok) throw new Error(after.error.code);
> console.log(after.result.stdout);
> ```
>
> Expect the **same** `boot_id` and higher Linux `MemTotal` once guest memory hotplug converges (usable Linux memory is slightly below configured MiB). Never issue repeated larger targets while waiting for guest visibility.

> [tab] Stopped Resize sequence
>
> Only run this sequence when interrupting running work is authorized:
>
> ```js theme={null}
> const stopped = await computer.stop();
> if (!stopped.ok || stopped.result.state !== "stopped") {
>   throw new Error("Stop not confirmed; query the Computer before continuing.");
> }
>
> const resized = await computer.resize({ ram_mib: targetMiB });
> if (!resized.ok || resized.result.disposition !== "next_start" ||
>     resized.result.computer.ram_mib !== targetMiB) {
>   throw new Error("Stopped Resize failed; inspect Computer state.");
> }
>
> const started = await computer.start();
> if (!started.ok || started.result.state !== "running" ||
>     started.result.ram_mib !== targetMiB) {
>   throw new Error("Start not confirmed; query original Computer ID.");
> }
> ```
>
> This is a cold boot on the preserved disk: reopen SSH or runtime URLs and start any services not managed at boot.

## Pool arithmetic

Suppose an Account has `4,096 MiB`, with Computer A running at `3,072 MiB` and Computer B at `1,024 MiB`. Requesting `1,024 MiB` for A while A is running returns `restart_required`—A continues occupying `3,072 MiB`, so you cannot spend the `2,048 MiB` difference yet. After an explicit Stop of A, A releases `3,072 MiB`; resizing A while stopped saves `1,024 MiB` (`next_start`, reserving nothing yet), and starting A claims `1,024 MiB` against the pool at Start time.

## Failure and recovery

| Result | Recovery |
| - | - |
| `INVALID_REQUEST` | Use integer 256 MiB increments (`>= 256`); CPU and disk fields are not Resize inputs |
| `ENTITLEMENT_REQUIRED` | Read `resources.get()` and restore active entitlement |
| `LIMIT_EXCEEDED` (`memory`) | Target exceeds Account pool; stop idle work or pick a smaller valid size |
| `RUNTIME_UNAVAILABLE` (`retry: "safe"`) | Platform capacity unavailable; retry deliberately later |
| `RESIZE_UNSUPPORTED` (`retry: "no-retry"`) | Path unsupported for this Computer; use explicit Stop → Resize → Start |
| `LIFECYCLE_BUSY` (`retry: "safe"`) | Wait `error.retry_after_seconds` and retry only the refused step |
| `UNKNOWN` (`retry: "query-first"`) | Read the Computer and `resources.get()`; Deepest conservatively holds capacity while unresolved |

Resize does not change disk size, fork live memory, or automatically migrate to another Computer. See [Snapshots and restore](https://docs.deepest.dev/computers/snapshots-and-restore.md), [Account resources](https://docs.deepest.dev/concepts/account-resources.md), and [Errors](https://docs.deepest.dev/api-and-sdk/errors.md).


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