Memory
hey so, im using chokidar + function to send a message to a channel but everytime i do. Im assuming it caches the attachment sent because, it jumps +8mb of memory everytime the function is called and holds that memory and keeps adding to it when the function is called another time. i have messages cache set to 0 so it cant really cache messages, so why is it using 8mb of memory to send a video and holding the memory hostage 💔 it calls the function every 6 minutes and every 6minutes it adds +8mb to the memory which is an L.
4 Replies
- 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!
- ✅
Marked as resolved by OP
thats my chokidar, its well optimised and it do run 24/7, i need it to
i dont think the issue is with chokidar, i use the same in another process and it doesnt leak any memory
so im hoping that djs is caching its own attachment it sent and keeping a hold of it?
and finally thats my cache settings
nodejs 18
update not a djs issue,
i used to download with "stream" and write the file with write:
updated to:
which uses less memory now like 30mb less, but it still increases non stop everytime i download and write a file to my machine.
should i open a question in #other-js-ts ?
yes
djs downloads it for me?
oh thats cool ill do that
just like that?
yep
ok so that wouldnt work bc i need to download the file to rename it. so i have to use writeFile and axios.
sorry again replying from anothwr account i cant reach my computer
thats a question idk how to answer 💔
could the problem we with axios or write file
its hard to debug it
but yeah i monitored it and it literally holds the attachment in the memory after downloading it so idk.
i also seek to download it bc i want to rename the file too, i cant let djs handle it from the url
oh okay
using fetch the memory dropped around 20mb and stopped memory leaking, ig it was axios
so my issue is resolved