-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Description
Affected URL(s)
https://nodejs.org/api/process.html#processresourceusage
Description of the problem
Your documentation states that this figure is stored in kilobytes, but when I read about ru_maxrss
and try to evaluate it for myself, it looks like it's actually kibibytes.
Can you confirm if this is meant to say kilobytes, or if perhaps kibibytes is better suited?
Proposed solutions:
- Use the term kibibytes instead of kilobytes.
- If the term kibibyte feels pedantic/confusing, it could be worth using KiB. People who know will know exactly what it means, people who don't know/care will usually assume kilobytes anyway, the same meaning as it has now.
- Alternatively, it could be worth writing in brackets after the term kilobyte either
(1,000 bytes)
or(1,024 bytes)
depending on which it is, to remove the ambiguity without changing the term.
Reference:
The term 'kilobyte' has traditionally been used to refer to 1024 bytes… The usage of the metric prefix kilo for binary multiples arose as a convenience, because 1024 is approximately 1000.
…
In December 1998, the IEC addressed such multiple usages and definitions by creating prefixes such as kibi, mebi, gibi, etc., to unambiguously denote powers of 1024… These prefixes are now part of IEC 80000-13. The IEC further specified that the kilobyte should only be used to refer to 1000 bytes. The International System of Units restricts the use of the SI prefixes strictly to powers of 10.
— Wikipedia: Kilobyte | Binary (1024 bytes) (emphasis mine)
Screenshots
In this screenshot, you can see that both the RAM allocation reported by htop
and maxRSS
match. But this can be confusing as htop
displays in kibibytes (KiB, 1,024 bytes) while the documentation for maxRSS
states it's reported in kilobytes (KB, 1,000 bytes), which is how I realized something seemed off here. They either shouldn't match, or they should reportedly be displaying in the same unit.

Notes
The difference is trivial so it's not too big a deal for my use case at least. I just prefer when docs are unambiguous.
I'm currently working on something for github.com/svg/svgo where I include the maxRSS
in the test report in a human-readable format. The output would around 0.006~ GiB off if I treated maxRSS
as KB (1,000 bytes) instead of KiB (1,024 bytes), and wouldn't match the result in top
/htop
.