Skip to content

Feature request: Get usable memory from cgroups, etc. #2286

@kjin

Description

@kjin

As cgroups (and possibly other kernel-level resource limits) may specify a limit on the amount of memory a process can consume, it would be useful for this library to expose an API like uv_get_usable_memory (in addition to total and free). Node.js would be able to then use this to set a memory limit for V8 isolates (see nodejs/node#27508).

I've put something together for linux/cgroups here. I wanted to get feedback before taking time to flesh it out more. In particular, I think if we introduce this API, that we could iteratively implement it for other OS's besides Linux, and in the meantime just return a very high value as a place holder (cgroups itself uses a value of 0x7FFFFFFFFFFFF000 to represent no memory limit).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions