Memory profiling with sharding
When using the
ShardingManager
, using node's memory profiler (node --inspect index.js
) only shows the memory usage of the index.js
file. It does not show memory usage of the bot.js
file, that is spawned from the ShardingManager
. How would I go about profiling the memory usage of bot.js
?
Node: 20.18.0
Discord.js: 14.16.32 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!To analyze memory usage in bot.js processes, add the --inspect=0 argument in ShardingManager's execArgv to enable the inspector on each shard. Then use chrome://inspect to connect to bot.js processes or send memory data to the main process using IPC (process.memoryUsage()).