> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 包含一个系统表，记录通过 jemalloc 分配器在不同大小类（bins）中进行的内存分配信息，这些信息汇总自所有 arena。

# system.jemalloc_bins

<Info>
  **在 ClickHouse Cloud 中查询**

  此系统表中的数据分别保存在 ClickHouse Cloud 各节点的本地。因此，如需查看所有数据的完整情况，需要使用 `clusterAllReplicas` 函数。更多详情请参见[此处](/zh/reference/system-tables/overview#system-tables-in-clickhouse-cloud)。
</Info>

<div id="description">
  ## 说明
</div>

包含通过 jemalloc 分配器在不同大小类 (bins) 中进行的内存分配信息，这些信息聚合自所有 Arena。
由于 jemalloc 中的线程本地缓存，这些统计信息可能无法做到绝对准确。

<div id="columns">
  ## 列
</div>

* `index` ([UInt16](/zh/reference/data-types)) — 按大小顺序排列的 bin 的索引。
* `large` ([UInt8](/zh/reference/data-types)) — 大型分配为 True，小型分配为 False。
* `size` ([UInt64](/zh/reference/data-types)) — 此 bin 中分配的大小。
* `allocations` ([Int64](/zh/reference/data-types)) — 分配数量。
* `deallocations` ([Int64](/zh/reference/data-types)) — 释放数量。
* `nregs` ([Int64](/zh/reference/data-types)) — 每个 slab 的区域数。
* `curslabs` ([Int64](/zh/reference/data-types)) — 当前的 slab 数量。
* `curregs` ([Int64](/zh/reference/data-types)) — 此 size class 当前的区域数。

<div id="example">
  ## 示例
</div>

找出对当前总体内存使用量贡献最大的各项内存分配大小。

```sql theme={null}
SELECT
    *,
    allocations - deallocations AS active_allocations,
    size * active_allocations AS allocated_bytes
FROM system.jemalloc_bins
WHERE allocated_bytes > 0
ORDER BY allocated_bytes DESC
LIMIT 10
```

```text theme={null}
┌─index─┬─large─┬─────size─┬─allocactions─┬─deallocations─┬─active_allocations─┬─allocated_bytes─┐
│    82 │     1 │ 50331648 │            1 │             0 │                  1 │        50331648 │
│    10 │     0 │      192 │       512336 │        370710 │             141626 │        27192192 │
│    69 │     1 │  5242880 │            6 │             2 │                  4 │        20971520 │
│     3 │     0 │       48 │     16938224 │      16559484 │             378740 │        18179520 │
│    28 │     0 │     4096 │       122924 │        119142 │               3782 │        15491072 │
│    61 │     1 │  1310720 │        44569 │         44558 │                 11 │        14417920 │
│    39 │     1 │    28672 │         1285 │           913 │                372 │        10665984 │
│     4 │     0 │       64 │      2837225 │       2680568 │             156657 │        10026048 │
│     6 │     0 │       96 │      2617803 │       2531435 │              86368 │         8291328 │
│    36 │     1 │    16384 │        22431 │         21970 │                461 │         7553024 │
└───────┴───────┴──────────┴──────────────┴───────────────┴────────────────────┴─────────────────┘
```
