djs memory usage in bun

hi, I’ve been running our test discord bot on bun to try it out (some websocket issues have been fixed recently) and it runs without issue, which is great! But the memory usage is a lot higher, with this bot in 22 servers using 120mb (as opposed to about 70mb on node), which is weird because I would expect it to use less Of course I asked in the Bun server first, and I was told that v8’s garbage collector is much more aggressive than jsc’s, implying that there is some leaky code in djs. Anyone know or aware of anything about this?
8 Replies
d.js toolkit
d.js toolkit5mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
dawnniie
dawnniie5mo ago
latest djs and bun
Toast
Toast5mo ago
Afaik, memory consumption is different for each bots, no matter how large or small the bot's codebase can be. But also, some intents plays a role in memory consumption too.
dawnniie
dawnniie5mo ago
I know, but this is the exact same bot, code, configuration and everything. Only difference is runtime
crawl
crawl5mo ago
and I was told that v8’s garbage collector is much more aggressive than jsc’s, implying that there is some leaky code in djs.
How does this imply one thing over the other? It just means the GC runs differently which has nothing to do with userland code
dawnniie
dawnniie5mo ago
sorry I was paraphrasing more lightly they did say outright that there were memory leaks I’m not saying I immediately believe them but I’m curious whether you think this is plausible or something different
crawl
crawl5mo ago
sorry but no one can just "say" that without looking at an inspector I don't think this is the case The GC running more lax than the one from v8 already says a lot why it uses more memory, it keeps things in memory longer or takes a longer time to remove references Thus your memory usage is higher, but it should be stable regardless
dawnniie
dawnniie5mo ago
okay I see yeah I only took what they claimed with a grain of salt because they very clearly don’t like djs for whatever reason I might look into it some more idk thanks for your help