-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
OS API is missing available memory call in NodeJS #31243
Comments
This is ultimately a libuv issue because node calls
uint64_t uv_get_available_memory(void) {
return uv_get_free_memory();
} That said...
...if you plan on using it as an input signal for e.g. "can I start this memory-consuming program?" then it's probably the wrong approach - it's a snapshot of a dynamic situation, one that may have changed dramatically in the time window between the call and the exec. |
OK, Yea let's see what's the best solution for fetching this number. It's not for determining for starting memory heavy apps. I actually noticed this usage of 'free memory' on the system information page of Wekan, admin panel. Wekan is an open source to-do manager, using nodejs. I was in panic when application was saying I only had about 100mb free of memory. But actually I think the available memory should be reported in these kind of instances. |
+1 on discussing in a TSC meeting before landing. |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
The MemFree -> MemAvailable change was made in libuv/libuv#3351 and is available in v16.x+ so I think this issue is good to close. |
The free commands says actually that I have 1832 MBs available, which is the free amount + some part of the buff/cache that can be cleared directly when needed.
The free column should be small, since this is memory which is not used is simply wasted. Available memory is the amount of memory which is available for allocation to a new process or to existing processes.
Knowing all this, the NodeJs OS API (
var os = require('os')
) only providesos.freemem
andos.totalmem
. The free memory NodeJS API call indeed shows the same value as what the free command gives me. But the OS API does NOT have any call like:os.availablemem
or something simular.Bottom-line: I'm missing the available memory call in NodeJS. Which is often way more useful.
For info:
Regards,
Melroy van den Berg
The text was updated successfully, but these errors were encountered: