> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# logHeapUsage

- **类型：** `boolean`
- **默认值：** `false`
- **CLI：** `--logHeapUsage`

打印每个测试的堆内存使用情况，有助于发现内存泄漏问题。


**CLI**

```bash
npx rstest --logHeapUsage
```


**rstest.config.ts**

```ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  logHeapUsage: true,
});
```


## 示例

在将 `logHeapUsage` 设置为 `true` 后，Rstest 将记录每个测试的堆内存使用情况。

```bash
 ✓ test/index.test.ts (2) 11 MB heap used
 ✓ test/index1.test.ts (2) 11 MB heap used

 Test Files 2 passed
      Tests 2 passed | 2 skipped (4)
   Duration 233ms (build 175ms, tests 58ms)
```
