High Memory Usage in Node & Bun
justkira
PROOP

7 months ago

i have 2 sevices like new has nothing just create a new sveltekit project and new hono project
Sveltekit is Using node-adpater
Hono is binary build using Bun

memory is Insanly high

On a Side note not sure if that mater im using Moonrepo which is a monorepo that Does optimized docker image well copying packages and stuff but highly dought it has anything to do with Bun or Node
i can link docker if that useful

im using Latest in both Node 24.6.0 and Bun 1.2.20

$10 Bounty

45 Replies

justkira
PROOP

7 months ago

0ba69faf-5b6c-4a2c-9ca4-5617915a12b5


justkira
PROOP

7 months ago

What is werid both have Same Usage like number wise which is quite werid


justkira
PROOP

7 months ago

High Memory Usage in Node & Bun


justkira
PROOP

7 months ago

Let me Clarify something the apps are super simple, sure maybe docker build is incorrect but i dont understand what do u mean with WebP , im talking about Docker images not images plus even if docker image is large it should large in file size not like memory usage.

Plus i don't want to sound rude but it feels like ai response

5. TypeScript build issues - If using TypeScript, you might have:

Redundant builds from sharing types between backend and frontend

Duplicate build processes

im suing bun for hono which build an optmized binary anyway


clashing
HOBBY

7 months ago

Is the memory spike at a certain interval of code execution, during a particular function being executed, or is the pattern randomly distributed?

Can you provide the metrics graph's snippets of the past 7 days for both services (select a deployed service on Railway, & then go to the Metrics section)? This will allow us to show which service is consuming the memory.


clashing

Is the memory spike at a certain interval of code execution, during a particular function being executed, or is the pattern randomly distributed?Can you provide the metrics graph's snippets of the past 7 days for both services (select a deployed service on Railway, & then go to the Metrics section)? This will allow us to show which service is consuming the memory.

justkira
PROOP

7 months ago

Well there is no spike its just simple deployed app there is no memory leak there is nothing it just a clean Hono backend and Sveltekit Project with no traffic thats ideal

Note thats a clean deploy so i have only 17H of data


justkira
PROOP

7 months ago

What does that have to do with my issue?


justkira
PROOP

7 months ago

Again its not realed to Images like png or webp its Docker Image not sure what AI u are using its super dumb there is no WEBP in the issue its again simple hono backend and sveltekit frontend DOCKER IMAGE


justkira
PROOP

7 months ago

ok this is kinda werid as hell

1406956460486824000


justkira
PROOP

7 months ago

there is no trafic or anything just a new deploy what is going on


7 months ago

according to the 'Public network traffic' graph it seems like there was ingress traffic happening at the same time the mem spiked


justkira
PROOP

7 months ago

@Medim still even if there a network

why idle is 680mb


7 months ago

Is the memory footprint similar if this is running locally?


justkira
PROOP

7 months ago

nope is on 180 usally

1407337451906662400


justkira
PROOP

7 months ago

plus i just woke up and see this


justkira
PROOP

7 months ago

i didn't change anything


@justkira - could provide provide a reproduction? I am on the Bun team. You can email me at conner@bun.com


7 months ago

@JustKira ^


justkira
PROOP

7 months ago

?


justkira
PROOP

7 months ago

?


7 months ago

Bun engineer replied to your thread asking for a reproduction
https://station.railway.com/questions/high-memory-usage-node-bun-f34a3603


justkira
PROOP

7 months ago

ya i sent him an email


justkira
PROOP

7 months ago

as he requested


7 months ago

Oh ok


justkira
PROOP

7 months ago

or did i miss read it or soemthing


7 months ago

no, it's good


justkira
PROOP

7 months ago

https://github.com/JustKira/moon-repo-railway-bun-memory-issue

let me link repo here for anyone want to try


justkira
PROOP

7 months ago

this is funny i didn't change anything

1407755296830390500


justkira
PROOP

7 months ago

umm this isn't funny any more what is going on

1409165391070236700


justkira
PROOP

7 months ago

bun seems going full haywire


7 months ago

are you in contact with Connor from bun? have you provided them an MRE?


justkira
PROOP

7 months ago

I did and also i send a email just now to see status update


justkira
PROOP

7 months ago

what is funny that bun almost 3x cost of all my other services compined XD


justkira
PROOP

7 months ago

I Hope i don't go bankrupt before the fix because im using bun s3 client will be hard for me to remove it now


7 months ago

Ah so you can't just switch back to Node to check if the memory leak is bun specific.


justkira
PROOP

7 months ago

well its kinda bun spefic i have sveltekit running on node


7 months ago

Though, if it makes the situation better, at least memory leaks aren't Railway specific! 🙂


justkira
PROOP

7 months ago

also hono node support is wake faced alot of issue


justkira
PROOP

7 months ago

I’m not 100 % sure, but there was a moment when every JS service suddenly ballooned in memory and then—almost in unison—dropped back down. The spike was only about 10 %, so it was pretty minor, but I figured it might have been triggered by an update on your end. Either way, Railway’s been rock-solid for me—smooth sailing all around.


7 months ago

Memory usage is not dependent on our systems, the memory usage is solely your application's usage.


justkira
PROOP

7 months ago

maybe rust to but it uses soo little memory i didn't notice


justkira
PROOP

7 months ago

intresting..


justkira
PROOP

7 months ago

Anyway, I’ll be off having a long, heartfelt chat with my wallet until Bun sorts out that weird memory issue.


justkira
PROOP

7 months ago

@Brody sorry to bother but why when i set limit 1gb memory dropped like that

1409178601240396000


7 months ago

Memory dropping after a re-deploy would be completely normal.


Loading...