Skip to content

process.resourceUsage().maxRSS reports in different units between Linux and macOS #44332

@wtchangdm

Description

@wtchangdm

Version

18.7.0

Platform

  • macOS 12.5.1 (Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64)
  • Debian GNU/Linux 11 (bullseye)

Subsystem

No response

What steps will reproduce the bug?

Simply run the following command on both platform.

$ node -e "console.log('rss', process.memoryUsage.rss(), '; max rss', process.resourceUsage().maxRSS)"

How often does it reproduce? Is there a required condition?

Always. No required condition.

What is the expected behavior?

According to the process.resourceUsage() document, maxRSS should have "maximum resident set size used in kilobytes".

What do you see instead?

On Linux (tag: 18.7.0-slim):

$ docker run --rm node:18.7.0-slim node -e "console.log('rss', process.memoryUsage.rss(), '; max rss', process.resourceUsage().maxRSS)"
rss 40235008 ; max rss 39292

On the other hand, macOS host:

$ node -v
v18.7.0
$ node -e "console.log('rss', process.memoryUsage.rss(), '; max rss', process.resourceUsage().maxRSS)"
rss 32104448 ; max rss 32108544

It looks like on Linux it reports correctly in kilobytes; but on macOS, it seems to be just bytes.

Additional information

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.libuvIssues and PRs related to the libuv dependency or the uv binding.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions