.
We had a similar issue in Bun and ended up doing this: https://github.com/oven-sh/bun/blob/4378ef8e97839f950ddfa180e466d0a8db187681/src/bun.js/event_loop.zig#L320 Just before the event loop idles, we check if the heap size changed since the previous check and if so, we schedule the garbage collector asynchronously. Then every so often we run a synchronous GC It fixed issues where Bun’s memory usage permanently would go up. But we still have issues with synchronous work. It doesn’t go down much if you do lots of blocking synchronous work
<rdar://problem/110488068>
<rdar://problem/110076652>
Pull request: https://github.com/WebKit/WebKit/pull/14945
Committed 265197@main (1a501dce9fa2): <https://commits.webkit.org/265197@main> Reviewed commits have been landed. Closing PR #14945 and removing active labels.