NEW 📢 Black Friday: our launch offer ends 30 Nov. Up to 70% off your first month on every game!See plans
Black FridayUp to 70% off your first month, ends 30 NovEnds in 9d 02h 53mBlack FridayUp to 70% off your first month, ends 30 NovEnds in 9d 02h 53mBlack FridayUp to 70% off your first month, ends 30 NovEnds in 9d 02h 53m

How much RAM does a Discord bot need?

Discord bot hostingUpdated Oct 29, 20265 min read

A small Discord bot with commands and moderation usually needs 128 to 256 MB of RAM, a bot with music or a database 256 to 512 MB, and a large bot that caches many members 512 MB to 2 GB. These are starting points: the language, the number of servers and members, and what the bot caches all change it, so check your Usage graph after a day of real use. PlayNHost's smallest bot plan, Starter, has 512 MB.

Starting points

BotUsually needs
A small bot with commands and moderation128 to 256 MB
A bot with music or a database256 to 512 MB
A large bot that caches a lot of members512 MB to 2 GB

The bot plans are Starter 0.5 GB, Standard 1 GB, Plus 2 GB, Pro 4 GB and Max 8 GB: Discord bot hosting. Starter's 512 MB covers most bots. A Lavalink music node is a separate plan with 1, 2 or 4 GB: Lavalink hosting.

How each language uses your plan

Bot typeWhat the server sets
Node.js Bot, Deno Bot, Discord TicketsThe JavaScript memory limit is set to 80% of your plan, so the bot stops with a clear error before it reaches the server's limit.
Java BotJava's heap is capped at 80% of your plan; the bot as a whole uses a little more.
BastionIts JavaScript memory is capped at half of your plan, because its MongoDB database runs in the same server.
JMusicBot, Ree6, LavalinkJava's heap is capped at 75% of your plan; the bot as a whole uses a little more.
Python Bot, Red, AI Chat Bot, Game Server Monitor and the othersNo limit of their own: the plan's memory is the limit.

What makes a bot use more

  • Caching. Libraries keep servers, members and messages in memory. Turning off caches you do not use is the simplest fix.
  • More servers and members. Every server the bot joins adds to the cache.
  • Privileged intents. Server Members and Presence make Discord send many more updates, and libraries keep them.
  • Add-ons. On Red, every cog you load adds to it.
  • Leaks. Memory that climbs all day and only drops at a restart usually means a list or a cache in the code that only grows.

Check your usage

  1. Open your server in the panel.
  2. On Overview, the Usage card has CPU, RAM and Storage, each with a live graph and the current figure against your plan's limit.
  3. Look after the bot has run for a day, not right after a start: How to read your server's usage graphs.

The Usage card on a bot server's Overview with the RAM tab selected and the graph against the plan limit.

If it runs out

A bot that uses more memory than the plan gives is stopped, and the console shows the panel's banner Your bot ran out of memory. Before that, you may see one of these:

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
java.lang.OutOfMemoryError: Java heap space

Make the bot keep less in memory, or move to a bigger plan: on the server's My plan page press Change plan. The server keeps its files. If it keeps stopping for other reasons, see Why your Discord bot keeps stopping.

Questions people ask

Is 512 MB enough for a Discord bot?

For most small bots, yes. Watch RAM on the Usage card after a day of real use.

What happens when my bot runs out of memory?

It is stopped and the console shows Your bot ran out of memory. A Node.js bot stops earlier, at 80% of the plan, with a heap error.

Can I add memory later without losing my files?

Yes. On My plan, press Change plan. The server keeps its files.

Already hosting your bot somewhere else? Move it to us

OUR LATEST BLOGS