Discord music bot: what uses the RAM
ffmpeg, yt-dlp, queue and audio buffers: where a music bot’s memory goes, how to measure it and how to reduce it.
A music bot does more than answer commands: it starts external processes, keeps a queue in memory and decodes audio continuously. On a free plan with 315 MB of RAM, every process counts. Here is what uses memory, how to measure it and what to reduce first.
- A music bot starts several processes: the bot, ffmpeg and sometimes yt-dlp.
- The queue weighs little as long as it only holds titles and identifiers.
- Memory that never comes back down points to a leak, to fix before buying more RAM.
The processes that use memory
Each playback can start several processes: the bot itself, ffmpeg to decode and convert the sound, and yt-dlp to fetch the stream when the source is a web address. Each one has its own memory.
- The bot process: your Node.js or Python code and the libraries loaded at startup.
- ffmpeg: decodes and converts the sound. Each server playing music adds its share.
- yt-dlp: called to extract a stream from an address, it only lives while the fetch runs.
The queue and the data
The queue lives in memory. A list of titles and addresses weighs little. What really weighs is the data fetched and kept: large metadata, images, playback buffers that are never released.
- Keep only titles and identifiers in the queue, not whole audio files.
- Release the buffers and playback objects when a track ends.
- Limit the queue size, for example to a few dozen tracks per server.
Measure and reduce
Measure during real playback, then an hour later. Memory that keeps rising and never comes back down points to a leak. Also check for ffmpeg processes still running after a track ends.
- Note the usage during playback, then after an hour of listening, and compare.
- An ffmpeg left running after a track uses memory for nothing: stop it explicitly.
- Usage that never comes back down is a leak: fix it before changing plan.
Why ACLClouds for a music bot
ffmpeg, yt-dlp and deno are already installed in the Node.js and Python images: nothing to compile. A music bot that goes beyond 315 MB can move to a plan with more memory.
- Free plan: 315 MB of RAM and 0.25 vCPU, to test a light music bot.
- ffmpeg, yt-dlp and deno included in the Node.js and Python images.
- For more memory, the Linux Essentiel VPS gives 16 GB of RAM, 4 vCPU and 80 GB of storage, at 9.99 € per month.
Frequently asked questions
Why does my music bot crash after a few hours?
Often because of a leak: streams or ffmpeg processes that stay open. Measure RAM over time. If it keeps rising, fix the code before changing plan.
Is ffmpeg included?
Yes. ffmpeg, yt-dlp and deno are already installed in the ACLClouds Node.js and Python images: there is nothing to compile.
Does a music bot need many vCPUs?
Audio decoding uses the processor, but memory is often the first limit on the free plan. Measure both before choosing a plan.