diff options
author | 2022-11-19 22:21:35 -0800 | |
---|---|---|
committer | 2022-11-19 22:21:35 -0800 | |
commit | 17fa4211ac8676a04a2dc944f24dddd287c2b1fd (patch) | |
tree | c7861e771b7645c9759995ecdb79836aee6a931b /test/bun.js/gc.js | |
parent | 81a1d8f5896d7f627ec70f9896afe4b17bc4d189 (diff) | |
download | bun-17fa4211ac8676a04a2dc944f24dddd287c2b1fd.tar.gz bun-17fa4211ac8676a04a2dc944f24dddd287c2b1fd.tar.zst bun-17fa4211ac8676a04a2dc944f24dddd287c2b1fd.zip |
Introduce `Bun.unsafe.gcAggressionLevel` API
Diffstat (limited to 'test/bun.js/gc.js')
-rw-r--r-- | test/bun.js/gc.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/bun.js/gc.js b/test/bun.js/gc.js index 350f279a1..6c444126f 100644 --- a/test/bun.js/gc.js +++ b/test/bun.js/gc.js @@ -12,3 +12,13 @@ export function gcTick(trace = false) { setTimeout(resolve, 0); }); } + +export function withoutAggressiveGC(block) { + const origGC = Bun.unsafe.gcAggressionLevel(); + Bun.unsafe.gcAggressionLevel(0); + try { + return block(); + } finally { + Bun.unsafe.gcAggressionLevel(origGC); + } +} |