aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/gc.js
blob: 9212e8b7678b892d8bfa8e6d6b9f7c2e41537cd7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export function gc() {
  // console.trace("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("");
  // console.trace("hello");
  gc();
  return new Promise((resolve) => {
    setTimeout(resolve, 0);
  });
}