Sch*_*DIA 2 javascript node.js discord.js
我要创建一个名为_ram的命令,该命令应显示bots ram的当前用法。我已经尝试过这些东西:
${client.performance.memory} //(Says memory is not defined)
${window.performance.memory} //(Window is not defined)
Run Code Online (Sandbox Code Playgroud)
有一种有效的显示方式吗?
如果您想知道Node.js进程正在使用多少内存,可以查询:
process.memoryUsage().heapUsed / 1024 / 1024;
Run Code Online (Sandbox Code Playgroud)
它将以字节为单位输出您的进程使用的内存。它不会显示Node.js使用的实际内存,因为在这种情况下,您还需要考虑Node.js垃圾收集器。