mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Create gc.js
This commit is contained in:
14
integration/bunjs-only-snippets/gc.js
Normal file
14
integration/bunjs-only-snippets/gc.js
Normal file
@@ -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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user