aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/gc.js
blob: 327b7d9a51bd62a274f14fe3b75439f070bca9cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);
  });
}