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

> 来自 jemalloc 堆内存 profiler 的每个存活采样分配占一行；读取该表会刷写一份新的堆内存 profile。只有启用了 profiler 的线程（`jemalloc_enable_profiler` SETTING 或 `jemalloc_enable_global_profiler` config）才会贡献数据；每行大致代表 `weight` 次类似的分配。

# system.jemalloc_sampled_allocations

## 说明

来自 jemalloc 堆内存剖析器 的每个存活的采样分配 (sampled allocation) 对应一行；读取该表会刷写一份新的堆内存剖析。只有启用了 profiler 的线程才会贡献数据 (通过 `jemalloc_enable_profiler` SETTING 或 `jemalloc_enable_global_profiler` config) ；每行大致代表 `weight` 个类似的分配。

## 列

* `trace` ([Array(UInt64)](/docs/zh/reference/data-types/array)) — 分配调用栈的地址，叶子 (leaf) 栈帧在前 (与 `system.trace_log.trace` 的约定一致) 。可使用 `addressToSymbol` 和 `demangle` 进行符号化 (需要 `allow_introspection_functions`) 。
* `age_ns` ([UInt64](/docs/zh/reference/data-types/int-uint)) — 该次分配已存活的时间 (纳秒) ，相对于 profile 被刷写的时刻计算。
* `size` ([UInt64](/docs/zh/reference/data-types/int-uint)) — 请求的分配大小，单位为字节。
* `usize` ([UInt64](/docs/zh/reference/data-types/int-uint)) — 可用大小 (字节) ，即该请求被向上取整到的大小类。
* `size_class` ([UInt16](/docs/zh/reference/data-types/int-uint)) — 大小类的索引。对于较小的大小类，可与 `system.jemalloc_bins.index` 进行 join。
* `arena` ([UInt32](/docs/zh/reference/data-types/int-uint)) — 提供本次分配的 arena 的索引。
* `thr_uid` ([UInt64](/docs/zh/reference/data-types/int-uint)) — 执行分配的线程在 jemalloc 内部的唯一 id。
* `sample_interval` ([UInt64](/docs/zh/reference/data-types/int-uint)) — 两次采样之间平均分配的字节数，取自 profile 的头部信息。所有行的该值相同。

**别名：**

* `alloc_time` — `now() - intDiv(age_ns, 1000000000)` 的别名。
* `weight` — `1 / (1 - exp((-usize) / sample_interval))` 的别名。
