3 ms·
How does Bun’s GC work? I have a CLI ghat does some processing and Bun used all the memory and pushed me deep into swap on a 64gb ram machine. I added some Bun
by sroussey 4y ago
How does Bun’s GC work?
I have a CLI ghat does some processing and Bun used all the memory and pushed me deep into swap on a 64gb ram machine. I added some Bun.sleep(1) in the some loops to give the GC more time but that didn’t help much.
- Jarred 4y agoThis sounds like a GC scheduling bug in Bun For now, try doing Bun.gc() and if that doesn’t help enough, try Bun.gc(true). This isn’t a great solution because it will make your code slower The GC schedules automatically on event loop tasks and in a few other points in the lifecycle of the application. It is not yet scheduling under memory pressure events and I think that’s what’s missing here
- bhaney 4y agoAre you sure you don't just have a memory leak in your code? Even in javascript, if you're accidentally keeping accessible references to objects you aren't intending to access again, they can't be freed by the gc
- sroussey 4y agoNo, it’s a single loop loading from one db table and into another (transformed).