# helia_aot.memory.defines.ArenaUsage

## helia_aot.memory.defines.ArenaUsage

`class` · `python`

```python
ArenaUsage()
```

Metadata for a memory arena.

Provisional: importable, but outside the compatibility promise; a minor release can change or remove it.

Source: `helia_aot/memory/defines.py:212`

### helia_aot.memory.defines.ArenaUsage.memory

`attribute` · `python`

```python
memory: MemoryType = Field(..., description='Runtime memory of the arena.')
```

Runtime (kernel-visible) memory of the
arena.

Source: `helia_aot/memory/defines.py:233`

### helia_aot.memory.defines.ArenaUsage.total_size

`attribute` · `python`

```python
total_size: int = Field(default=0, description='Total bytes in this arena')
```

Total bytes in this arena.

Source: `helia_aot/memory/defines.py:234`

### helia_aot.memory.defines.ArenaUsage.used

`attribute` · `python`

```python
used: int = Field(default=0, description='Bytes actually used')
```

Bytes actually used. For bump-allocated arenas
(constant, persistent) this equals ``total_size``.

Source: `helia_aot/memory/defines.py:235`

### helia_aot.memory.defines.ArenaUsage.role

`attribute` · `python`

```python
role: ArenaRole = Field(default=ArenaRole.SCRATCH, description='Logical role of the arena (scratch | persistent | constant).')
```

Logical role of the arena.

Source: `helia_aot/memory/defines.py:236`

### helia_aot.memory.defines.ArenaUsage.source_memory

`attribute` · `python`

```python
source_memory: MemoryType = Field(default=None, description="Cold-storage source memory for the arena's contents. Equals ``memory`` for scratch, persistent, and cold constant arenas; differs from ``memory`` for staged constant arenas where bytes are copied at boot from this source memory into the writable runtime arena. Defaults to None for backward compatibility with callers that construct ArenaUsage directly; the bundled GreedyPlanner always populates it.")
```

The cold-storage memory the
arena's contents are sourced from. For scratch and
persistent arenas this equals ``memory`` (purely runtime,
no source blob). For constant arenas it equals ``memory``
in the cold case (arena buffer is the cold blob in place)
and differs from ``memory`` in the staged case (arena
buffer is a writable runtime copy of a source blob in
``source_memory``).

Source: `helia_aot/memory/defines.py:240`

### helia_aot.memory.defines.ArenaUsage.alignment

`attribute` · `python`

```python
alignment: int = Field(default=16, description='Resolved alignment of the arena base symbol (and floor for slot offsets within it). Stamped by the planner from max(implementation floor, platform.min_alignment, MemoryConstraint.arena_alignment).')
```

Source: `helia_aot/memory/defines.py:253`

### helia_aot.memory.defines.ArenaUsage.is_staged

`attribute` · `python`

```python
is_staged: bool
```

True iff this arena has a distinct cold source memory.

Equivalent to ``source_memory is not None and source_memory !=
memory``. Centralizes the cold-vs-staged predicate so
templates and handlers do not duplicate it.

For scratch and persistent arenas this is always ``False``
(they have no cold source). For constant arenas it
distinguishes the two emit shapes:

- ``False`` (cold): the arena buffer itself is a
  ``static const`` blob in cold storage.
- ``True`` (staged): the arena buffer is a writable runtime
  copy hydrated from a separate source blob in
  ``source_memory``.

Source: `helia_aot/memory/defines.py:272`

### helia_aot.memory.defines.ArenaUsage.allocate

`method` · `python`

```python
allocate(size: int) -> int
```

Allocate a segment of the arena and return its offset

Source: `helia_aot/memory/defines.py:263`
