You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Memory should be reclaimed after all Blob references are removed and Bun.gc(true) is called. Node.js correctly frees ~73% of allocated memory in the same scenario.
What do you see instead?
Bun releases 0% of memory. Full comparison on the same machine:
Bun 1.3.11
Node v25.6.0
Start
105.1 MB
56.9 MB
Peak
184.2 MB
125.3 MB
After GC
184.3 MB
75.3 MB
Released
-0.2 MB (0%)
50.0 MB (73%)
Additional information
Related issues:
Memory Leak with Blob/ArrayBuffer and Bun's Garbage Collection #12941 — I originally reported this on Bun 1.1.21. It was closed as "won't fix" by @Jarred-Sumner who used a modified repro wrapping blobs in a function scope. However, explicitly clearing references (blobs = []) + forced GC should work identically to scope exit — that's basic GC behavior. The bug persists on 1.3.11.
Bun memory leak with simple fetch polling script #28427 — Same underlying issue (fetch memory leak), opened recently, also on 1.3.11. The automated bot (robobun) marked it as "unable to reproduce" but used a local HTTP server instead of real remote fetches, which doesn't trigger the same code path for Blob/body buffering.
This is a clean, minimal repro with no cache: "force-cache", no frameworks, no extra dependencies — just fetch → blob() → dereference → GC. The issue is in how Bun's runtime handles Blob/ArrayBuffer backing stores during garbage collection.
What version of Bun is running?
1.3.11
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What steps can reproduce the bug?
blobs = []) to remove all referencesBun.gc(true)multiple times, wait 8+ secondsSingle-file repro that works with both Bun and Node:
What is the expected behavior?
Memory should be reclaimed after all Blob references are removed and
Bun.gc(true)is called. Node.js correctly frees ~73% of allocated memory in the same scenario.What do you see instead?
Bun releases 0% of memory. Full comparison on the same machine:
Additional information
Related issues:
Memory Leak with Blob/ArrayBuffer and Bun's Garbage Collection #12941 — I originally reported this on Bun 1.1.21. It was closed as "won't fix" by @Jarred-Sumner who used a modified repro wrapping blobs in a function scope. However, explicitly clearing references (
blobs = []) + forced GC should work identically to scope exit — that's basic GC behavior. The bug persists on 1.3.11.Bun memory leak with simple fetch polling script #28427 — Same underlying issue (fetch memory leak), opened recently, also on 1.3.11. The automated bot (robobun) marked it as "unable to reproduce" but used a local HTTP server instead of real remote fetches, which doesn't trigger the same code path for Blob/body buffering.
This is a clean, minimal repro with no
cache: "force-cache", no frameworks, no extra dependencies — justfetch→blob()→ dereference → GC. The issue is in how Bun's runtime handles Blob/ArrayBuffer backing stores during garbage collection.