diff options
author | 2022-04-02 00:49:27 -0700 | |
---|---|---|
committer | 2022-04-02 00:49:27 -0700 | |
commit | db39c8e109c58e44fd7a15f88fb510680352eea8 (patch) | |
tree | 1d371111ba514a99679fa160d77f012c98ec7746 /integration/bunjs-only-snippets/gc.js | |
parent | 449c248f081f2278a2b300785aeaa9914b6f2bf0 (diff) | |
download | bun-db39c8e109c58e44fd7a15f88fb510680352eea8.tar.gz bun-db39c8e109c58e44fd7a15f88fb510680352eea8.tar.zst bun-db39c8e109c58e44fd7a15f88fb510680352eea8.zip |
Create gc.js
Diffstat (limited to 'integration/bunjs-only-snippets/gc.js')
-rw-r--r-- | integration/bunjs-only-snippets/gc.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/gc.js b/integration/bunjs-only-snippets/gc.js new file mode 100644 index 000000000..327b7d9a5 --- /dev/null +++ b/integration/bunjs-only-snippets/gc.js @@ -0,0 +1,14 @@ +export function gc() { + Bun.gc(true); +} + +// we must ensure that finalizers are run +// so that the reference-counting logic is exercised +export function gcTick(trace = false) { + trace && console.trace(""); + + gc(); + return new Promise((resolve) => { + setTimeout(resolve, 0); + }); +} |