Repository navigation
Os.freemem() under Linux #27493
Description
Activity
Similar to #27386?
Node.js pulls its information straight from the OS by means of the sysinfo(2) system call. If you see the wrong numbers, you've found a kernel bug.
What does
cat /proc/meminfoprint?- addedosIssues and PRs related to the os subsystem.Issues and PRs related to the os subsystem.memoryIssues and PRs related to Node.js memory management or memory footprint.Issues and PRs related to Node.js memory management or memory footprint.
on Apr 30, 2019 Okay, I think I have an inkling of the cause.
Can you post the output of
uname -a,node -p process.archand the contents of thememory.limit_in_bytesandmemory.soft_limit_in_bytesfiles in/sys/fs/cgroup/memory? Thanks!My inkling was that this might have been a 32-to-64-bit (or vice versa) kernel compatibility issue but if both kernel and binary are 64 bits, that can't be it. It's probably still a kernel bug, just not that one. :-)
On the bright side, Node.js will start preferring
/proc/meminfoover sysinfo(2) in the near future (libuv/libuv#2258) so this issue should cease to exist before too long.Thank you for your anwser.
I will wait to try again with the future versions of nodejs.- added a commit that references this issue
on May 22, 2019 - added 2 commits that reference this issue
on Feb 26, 2020 Any update on this? Still happened at Node.js v16
@justb That probably means you don't have /proc mounted or /proc/meminfo doesn't have the expected format.



Version: 10.15.3 (LTS)
Platform: Linux (Ubuntu server 18.10)
Subsystem: Os.freemem()
Under Linux, Os.freemem() returns the used memory instead of the free one.