Open kpostekk opened 1 year ago
likely a memory leak of some kind
For me also, While before using Bun previous versions same/less memory utilisation comparing to Node.js. But since after upgrading to Bun 1.0.0, Memory utilisation reached double 2x. Definitely a memory leak I think.
FWIW, I've noticed a similar memory leak when switching a simple ExpressJS application over from NodeJS (running Bun 1.0.1). The first half of graph was when it was on NodeJS, the second half is after we switched to Bun.
We have another application running 0.8.1 and it is not leaking memory, so more evidence that it may be a recently introduced bug.
I just successfully migrated a express nodejs app to bun and the memory consumption increased from 200 MiB to arround 600 MiB. :cry: Bun version 1.0.1.
We will prioritize reducing memory usage in the coming weeks. Might be like two weeks though
same problem ;-) but with prisma
bun version: Both v1.0.0 and v1.0.1
It must be a memory leak, because the memory will continue to grow without an upper limit with each benchmark
bombardier --fasthttp -c 1000 -d 60s http://127.0.0.1:3000/
Ran into a memory leak today. +1 to prioritizing fixing memory issues. Scared to adopt Bun in production.
+1
I tried to deploy to my AWS development env and encountered an out of memory
error - according to my tests, my bun build (base image = oven/bun) required ~600 MB while my dev only has 500 MB.
Comparing that to my node build, which required ~100 MB - is this the expected behavior of bun or a bug?
My Remix application with Bun.serve cost more than 5GB in 10 min, generateHeapSnapshot()
didn't show no memory leak in my code.
Comparing to NodeJS, which only use ~250MB without any memory leaks.
yeah we will work on this stuff soon, currently focused on bun install
workspace-related issues and then will circle back to this
Hey, also want to share my findings 😄 , i am using the websocket form Bun, and when the app is build with bun build it uses twice of the ram, and when i run the ts file directly it uses the same amount of ram on a Debian system and less ram on a MacOS, the cpu is very low compared to node but that one also is higher when build
Build
Run TS
Can also confirm. Switching from node to bun, memory went up almost 3 times and increased rather quickly compared to Node
Hi all,
Did Bun v1.0.4
fix this issue?
@bnol hey, not in my case, i am using web sockets and the built version is still double
I've been running this since the release. At first it looked like nothing was going to change but it does seem to be maintaining a lower level of memory over all. NodeJS is still less though by about 15MB.
@bnol also not for my case, still triple the memory of nodejs (using express server with graphql and postgres DB)
Not for me, I couldn't even start the process, bun is using all of my ec2 memory and it crashes before staring
Also I don't even use the serve function
1.0.4 seems to be using slightly less than 1.0.3, but still about 130mb compared to 50mb I had with pure node. I'm using fetch, though, so I don't know if the changes in 1.0.4 actually apply to me
Hi all,
Did Bun v1.0.4
- Reduce memory usage of HTTP server by @Jarred-Sumner in Reduce memory usage of HTTP server #6135)
fix this issue?
i managed to reduce the ram from bun with this build script, now the used ram at start from 70 MB ram dropped to 30mb ram, idk why by running the the build command before it had double ram
const result = await Bun.build({
entrypoints: ['./app/index.ts'],
outdir: './dist',
minify: true,
target: 'bun',
external: ['@supabase/supabase-js'] // This dep is not supported with bun
});
if (!result.success) {
console.error(...result.logs);
process.exit(-1);
}
console.log(...result.logs);
Bun v1.0.4 dropped usage almost in half for me, but the recent Bun v1.0.7 doubled it again. Continuing to monitor but it almost looks like a memory leak to me:
You should see it drop a little bit in Bun v1.0.8 thanks to fixing a memory leak in require()
For the same Nest.js "hello world" app:
Node.js v20.8.0: 67 MB Bun v1.0.8: 76 MB Bun v1.0.7: 110 MB
We still have more work to do to fully address this issue.
We're still facing heavy memory leak problem on bun v1.1.21
Anybody found any workaround or fix or debugged? Any pointers appreciated.
For us the memory consumption is also still a lot higher compared to node, even on the latest bun version.
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
What platform is your computer?
Linux 6.4.13-200.fc38.x86_64 x86_64 unknown
What steps can reproduce the bug?
I run a simple NestJS application which parses input and starts a NestJS application.
The index file:
The
SimModule
has one service, which periodically calls GraphQL api.dist/index.js
is build result fromtsc
.What is the expected behavior?
Ram usage similar to node:
What do you see instead?
3.6x of previous result:
Additional information
The OS is Fedora 38 Server in a KVM, headless. Relates to #1641