> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/smc/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/smc/latest/observability/dashboard-beam-erts-memory-allocators.md).

# ERTS memory allocators dashboard

**ERTS memory allocators** Grafana dashboard shows per-allocator memory usage for the Erlang Runtime System (ERTS) running Session Management Controller (SMC). It is based on the metrics that the Erlang VM exposes through `prometheus.erl` and is pre-configured with the following sections:

- [Allocator overview](#allocator-overview)
- [Per-allocator detail](#per-allocator-detail)

The dashboard is bundled with the SMC Support chart and is disabled by default. Enable it under `dashboard.dashboards.beam-erts-memory-allocators` in the support chart values.

For a higher-level memory view, use the [BEAM dashboard](https://docs.cennso.com/components/smc/latest/observability/dashboard-beam.md). For background on ERTS memory allocators, see the upstream [erts_alloc documentation](https://www.erlang.org/doc/apps/erts/erts_alloc.html).

> [!WARNING]
> The metrics on this dashboard are deep ERTS internals. Use them when diagnosing memory-related issues such as fragmentation, pool churn, or allocator misconfiguration. They are not a substitute for the application-level memory view in the BEAM dashboard.

## Dashboard variables

The dashboard exposes the following variables at the top:

- `cluster` - Kubernetes cluster name.
- `node_namespace` - Kubernetes namespace running SMC.
- `node_pod` - SMC pod selector. Multi-value, defaults to `All`.

## Allocator overview

This section gives a top-level view of memory allocation across all allocators, including:

- Allocated memory by allocator - pie chart of total memory share per allocator (eheap, binary, ets, ll, std, fix, driver, sl, temp).
- Allocated Memory - total bytes currently allocated across all allocators.
- RSS Memory - resident set size of the BEAM operating-system process.
- VSZ Memory - virtual size of the BEAM process.
- Used Memory - total bytes currently in use (excluding pool reserves and free carriers).
- Unused Memory - total bytes held by allocators but not currently in use. Persistent unused memory indicates fragmentation.

## Per-allocator detail

For each ERTS allocator the dashboard provides a uniform set of panels:

- Allocator timeseries (named after the allocator code, for example `eheap_alloc (H)` or `binary_alloc (B)`) - allocated memory over time, split into used vs unused.
- mbcs (multi-block carriers) utilisation - share of mbcs space currently in use. Low utilisation indicates fragmentation.
- Average mbcs carrier size - average size of multi-block carriers. Drift indicates the workload size profile changed.
- Average mbcs block size - average size of allocated blocks within mbcs.
- mbcs_pool utilisation - share of pool memory currently in use. Useful for spotting pool churn.
- mbcs_pool carriers - number of carriers currently in the pool.
- sbcs (single-block carriers) utilisation - share of sbcs space in use; allocations large enough to bypass the mbcs pool live here.
- Average sbcs carrier size - average size of single-block carriers.
- Average sbcs block size - average size of allocated blocks within sbcs.

The allocators covered are:

| Code | Allocator | Purpose |
|---|---|---|
| H | `eheap_alloc` | Erlang process heap. |
| B | `binary_alloc` | Reference-counted binaries. |
| E | `ets_alloc` | ETS table storage. |
| LL | `ll_alloc` | Long-lived objects (code, atoms, persistent terms). |
| S | `sl_alloc` | Short-lived objects. |
| T | `temp_alloc` | Temporary buffers. |
| D | `driver_alloc` | Driver- and NIF-allocated memory. |
| Fix | `fix_alloc` | Fixed-size object pools. |
| Std | `std_alloc` | Catch-all standard allocator. |

Each allocator has its own cluster of panels following the same layout described above.
