process.memoryUsage.rss()
- 返回:<integer>
process.memoryUsage.rss() 方法返回一个整数,表示以字节为单位的常驻内存集(RSS)。
【The process.memoryUsage.rss() method returns an integer representing the
Resident Set Size (RSS) in bytes.】
驻留集大小是指进程在主内存设备中占用的空间量(即总分配内存的一个子集),包括所有 C++ 和 JavaScript 对象及代码。
【The Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the process, including all C++ and JavaScript objects and code.】
这与 process.memoryUsage() 提供的 rss 属性的值相同,但 process.memoryUsage.rss() 更快。
【This is the same value as the rss property provided by process.memoryUsage()
but process.memoryUsage.rss() is faster.】
import { memoryUsage } from 'node:process';
console.log(memoryUsage.rss());
// 35655680const { memoryUsage } = require('node:process');
console.log(memoryUsage.rss());
// 35655680