[API reference](https://evolu.dev/docs/api-reference) › [@evolu/sqlite-wasm](https://evolu.dev/docs/api-reference/sqlite-wasm) › SqliteScratch

Defined in: [packages/sqlite-wasm/src/Memory.ts:143](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Memory.ts#L143)

Reusable memory for output parameters and bind values, allocated once per
database instead of once per call.

A callback inside a call, such as a collation-needed callback or a trace
callback, can run another call on the same database, which reuses this
memory. The outer call is unaffected, because SQLite copies a value bound
with SQLITE_TRANSIENT at once and writes an output parameter after the
callbacks of the call. What SQLite reads or writes before a callback and the
caller uses after it needs memory of its own: SQL, which SQLite parses in
place and copies only after the parse, and the size `sqlite3_serialize`
writes before it finalizes its query.

## Extends

- [`Disposable`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management)

## Properties

<a id="out"></a>

### out

```ts
readonly out: WasmPtr;
```

Defined in: [packages/sqlite-wasm/src/Memory.ts:148](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Memory.ts#L148)

Sixteen bytes, 8-byte aligned, for output parameters such as `ppDb`,
`ppStmt` and `pzTail`.

---

<a id="reserve"></a>

### reserve

```ts
readonly reserve: (byteLength: number) => Result<WasmPtr, SqliteNoMemError>;
```

Defined in: [packages/sqlite-wasm/src/Memory.ts:160](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Memory.ts#L160)

Returns memory of at least the given length, growing it when needed. The
previous contents are not kept, and the address is valid until the next
call. Growth doubles the capacity, so reallocations stay rare as values
grow, or, when that much memory is not available, allocates the length
alone. A failure leaves the scratch empty, so later calls are unaffected.

Binding text or a blob from here with SQLITE_TRANSIENT is faster than
allocating per value: SQLite copies into a buffer it reuses.

## Methods

<a id="dispose"></a>

### \[dispose\]()

```ts
[dispose](): void;
```

Defined in: node\_modules/@typescript/old/lib/lib.esnext.disposable.d.ts:34

#### Inherited from

```ts
Disposable.[dispose]
```