Skip to content

readProcessRssBytes

readProcessRssBytes(pid, procfsRoot?): Promise<number | null>

Defined in: packages/app-system/src/os/host-metrics.ts:78

Resident set size of another process in bytes, or null when the process is gone, the platform exposes no procfs, or the caller may not read it.

Reads VmRSS from /proc/<pid>/status rather than the resident-pages field of statm, because that one is a page count and the page size is not knowable from Node — 4 KiB is only the common case, and an arm64 kernel configured for 16 KiB pages would make every reading wrong by a factor of four.

Cheap enough to poll at second granularity, unlike getProcessesSnapshot, which spawns ps.

number

The process to inspect.

string = PROCFS_DEFAULT_ROOT

Root of the procfs mount. Defaults to /proc.

Promise<number | null>