Bun's memory usage grows uncontrollably on file reloads
16 posts since Apr 2024, all from GitHub.
“What version of Bun is running? 1.4.3 canary.1+bbdc5a519 What platform is your computer? Linux 6.18 x86 64 (4 cores, 15 GiB RAM) What steps can reproduce the bug? The project is in a private repository, so I can't share the source. I can run diagnostic builds or flags on…”
“What version of Bun is running? 1.4.3+c6da4a4d3 (also reproduces on canary 1.4.4 canary.1+5f5799ed1) What platform is your computer? Linux 6.18.40.1 microsoft standard WSL2 x86 64 (16 cores) What steps can reproduce the bug? Save the script below as repro.sh and run bash…”
“What version of Bun is running? 1.4.3 canary.1+b99371011 (also main at f04caca828) What platform is your computer? Linux x64 What steps can reproduce the bug? Run it with and without stack trace limit=50 . What is the expected behavior? Node v26.3.0: A new node:vm context starts…”
Bun servers experience memory leaks increasing by 20MB per file save during TypeScript server reloads. This causes applications to crash or require frequent restarts.
SOURCES (16)
“What version of Bun is running? 1.4.3+c6da4a4d3 (also reproduces on canary 1.4.4 canary.1+5f5799ed1) What platform is your computer? Linux 6.18.40.1 microsoft standard WSL2 x86 64 (16 cores) What steps can reproduce the bug? Save the script below as repro.sh and run bash repro.sh ./repro (creates…”
“What version of Bun is running? 1.4.3 canary.1+bbdc5a519 What platform is your computer? Linux 6.18 x86 64 (4 cores, 15 GiB RAM) What steps can reproduce the bug? The project is in a private repository, so I can't share the source. I can run diagnostic builds or flags on request. The project has 58 of its own files and 2,299 files in its program, mostly Effect 4 code. What is the expected behavior? The check finishes. tsc 7.0.2 ( incremental false ) checks the same project in 7.8 s with a 1.97 G”
“What version of Bun is running? 1.4.3 canary.1+b99371011 (also main at f04caca828) What platform is your computer? Linux x64 What steps can reproduce the bug? Run it with and without stack trace limit=50 . What is the expected behavior? Node v26.3.0: A new node:vm context starts with the process default for Error.stackTraceLimit . The default is 10, or the value of stack trace limit . What do you see instead? Error.stackTraceLimit is 100 in every node:vm context. Errors made in the context, and”
“What version of Bun is running? 1.4.0+34cbb9a40 What platform is your computer? Linux 7.1.3 1 MANJARO x86 64 unknown What steps can reproduce the bug? repro.ts Run either binary and load it for 20s ( autocannon c 150 d 20 http://localhost:4001/ ), sampling RSS with ps o rss= p <pid once a second. sourcemap=inline , 2.26M requests in 20s: Grows continuously, never plateaus. Settles at 136,780 KB after load stops (7x baseline). sourcemap=none , 2.27M requests in 20s: Bounded within the first secon”
“What version of Bun is running? 1.3.14 What platform is your computer? Linux 7.1.3 arch1 2 x86 64 unknown What steps can reproduce the bug? 1. init a project and install: a) typescript 5.9.3 b) zod 4.4.3 c) sequelize 6.37.8 2. copy the files from Additional information into that folder. 3. execute bun crash test.ts What is the expected behavior? There should be the thrown exception from crash test.ts but no bun crash What do you see instead? Instead of the expected i see this: Additional informa”
“What version of Bun is running? 1.3.12+700fc117a What platform is your computer? Darwin 25.3.0 arm64 arm What steps can reproduce the bug? A simple typescript file with just a console.log. Right click on the file Run "index.ts" Getting this message in the console : Bun as to be properly set up in webstorm, the run configuration is a Bun one. <img width="1203" height="549" alt="Image" src="https://github.com/user attachments/assets/0726aea5 e847 4ff0 b810 91177752551b" / <img width="1118" height=”
“What version of Bun is running? 1.3.11 canary.1+9e93bfa1b What platform is your computer? Linux 5.10.0 12 amd64 x86 64 x86 64 What steps can reproduce the bug? Hi, I would like to report a behavior in Bun that can be reproduced using the below snippet What is the expected behavior? Node eventually rejects the promise due to string size limits. What do you see instead? Bun tries to read entire unbounded file without throwing any error Additional information No response”
“What version of Bun is running? 1.3.3 canary.59+87eca6bbc What platform is your computer? Darwin 24.6.0 arm64 arm What steps can reproduce the bug? profileme.js: I compared the memory use of Bun and Node with the following commands: What is the expected behavior? Slow memory growth (from a glance at the .cpuprofile format, it doesn't seem very amenable to streamed output, so I understand some steady growth is inevitable, but it should not be this fast). What do you see instead? On this minimal e”
“What version of Bun is running? 1.2.10 What platform is your computer? Linux 5.15.0 122 generic x86 64 x86 64 What steps can reproduce the bug? I'm using Bun.js and noticed an unexpected behavior with process.memoryUsage(). The heapTotal value is smaller than heapUsed, which seems incorrect since heapTotal should include both used and unused heap memory. Below are the details: Observed Data: Memory Usage: RSS: 67.04 MB heapTotal: 3.10 MB heapUsed: 4.54 MB What is the expected behavior? No respon”
“What version of Bun is running? 1.2.10 What platform is your computer? windows What steps can reproduce the bug? just execute this script to memory track What is the expected behavior? memory usage to stay roughly at the same level bun should consume minimal system resources What do you see instead? memory usage keeps growing bun consumes over 100mb RAM while Node consumes 35mb Additional information No response”
“What version of Bun is running? 1.1.27 What platform is your computer? No response What steps can reproduce the bug? We’ve observed a memory leak when running our thumbnail proxy app under Bun 1.1.27+. The same app in 1.1.26 maintains steady memory usage. In newer versions, memory steadily grows until our container’s OOM killer terminates the process. Application Workflow 1. Receive an HTTP GET request (via Bun.serve + Hono.js). 2. Perform a fetch to an external CDN to retrieve a thumbnail image”
“What version of Bun is running? 1.1.40+b5b51004e What platform is your computer? Microsoft Windows NT 10.0.26120.0 x64 (Win11 Home Build 26120.2702) What steps can reproduce the bug? 1. clone https://github.com/Jacob26502/bun memory leak and bun install 2. open project in webstorm 2024.3.1+ with bun set as node js interpreter. 3. save any change to any TS file, so the TS server re loads it. (I used forwards slashes in a comment in index.tsx) 4. memory climbs by 2 20mb per save 5. does not reduce”
“What version of Bun is running? 1.1.33 What platform is your computer? Windows 10 19044 What steps can reproduce the bug? It takes up a lot of memory resources on Windows 10. Version Info Windows 10 19044 Bun 1.1.33 TypeScript Version 5.6.3 WebStorm 2024.2.4 Image What is the expected behavior? No response What do you see instead? No response Additional information No response”
“What version of Bun is running? 1.1.29+6d43b3662 What platform is your computer? Linux 6.1.102 x86 64 What steps can reproduce the bug? Running it continuously and serving millions of requests, then you can see a slight increase in memory over time. The heap stays the same size as it can be seen by heap dumps. But the overall memory consumption increases. Please see attached screenshots. I highly appreciate it if you could guide me to additional things I could do to track down that (likely) issu”
“What version of Bun is running? 1.1.27 canary.14+11d7a9d5e What platform is your computer? Microsoft Windows NT 10.0.19045.0 x64 What steps can reproduce the bug? Install next.js (tried on @rc version, all default). Take note of current memory. image Then bun run bun dev What is the expected behavior? Memory allocation increased slightly. image After rendering home page increased slightly again. image What do you see instead? Memory allocation increased greatly. image After rendering home page i”
“What version of Bun is running? 1.0.36+40f61ebb9 What platform is your computer? Darwin 23.4.0 arm64 arm What steps can reproduce the bug? Hey! I'm using Neovim as my IDE, and I thought that it would be cool to run the typescript lsp with Bun instead of Node so I could get a performance boost. The thing is, my editor was getting slower and I had to restart it quite frequently. After having a look to the memory, I saw that the memory usage keep going up every time I save, and almost by 1 giga eve”
