add gc-test plugin (#597)

This commit is contained in:
澄潭
2023-10-23 15:21:01 +08:00
committed by GitHub
parent 86b223bc75
commit d8e91851d9
5 changed files with 107 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
---
title: GC Test
keywords: [higress, gc test]
description: use to test the gc of tinygo
---
## Description
The `gc-test` plugin is used to test whether there are memory leaks in TinyGO's GC mechanism.
This plugin should not be used in production.
## Configuration Fields
| Name | Type | Requirement | Default Value | Description |
| ----------- | --------------- | -------- | ------ | ---------------------------------------------------- |
| `bytes` | Number | Required | - | Number of bytes allocated per-request |
## How to
The plugin will response the stats of memory as follows:
```bash
{"Sys": 15073280,"HeapSys": 10682368,"HeapIdle": 139264,"HeapInuse": 0,"HeapReleased": 0}
```
We can use bench tools to test whether the `HeapSys` field keeps growing, and then we can determine whether a memory leak has occurred.