Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/node): report freemem() on Linux in bytes #25511

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

littledivy
Copy link
Member

Fixes #25497

Comment on lines 238 to +241
if let Some(line) = line {
let mem = line.split_whitespace().nth(1);
let mem = mem.and_then(|v| v.parse::<u64>().ok());
mem_info.available = mem.unwrap_or(0);
mem_info.available = mem.unwrap_or(0) * 1024;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to man pages (https://man7.org/linux/man-pages/man5/proc_meminfo.5.html) the unit of the value is written in the line. Maybe we should parse it instead of using kB blindly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is always in kB [1] [2]

@littledivy littledivy merged commit ea8bf09 into denoland:main Sep 9, 2024
17 checks passed
@littledivy littledivy deleted the freemem_linux_fix branch September 9, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deno.systemMemoryInfo().available and (node:os).freemem() is off by x1000
2 participants