The implementation of os::commit_memory_limit() on Windows currently returns the size of the available virtual address space. While it is true that the amount of memory that can be committed is upper-bound by the size of the virtual address space, it is practically unlimited, since there is no way to limit the size of the virtual address space, except for using it all up. A different approach to detecting a limit on how much memory can be committed is to look at limits set by a Job Object. Job Objects can limit how much memory can be committed for all processes in a Job or a specific process in a Job. Limiting memory via Job Objects does not affect the size of the virtual address space.
If the process is not in a Job or no limit has been set on how much memory can be committed, we can either return SIZE_MAX or the size of the available virtual address space. There should be no issue with returning SIZE_MAX, as for all intents and purposes, the virtual address space is practically unlimited.
Adding support for Job Objects in this way adds support for detecting memory limits when using native Windows Hyper-V containers, which uses Job Objects to limit memory.
If the process is not in a Job or no limit has been set on how much memory can be committed, we can either return SIZE_MAX or the size of the available virtual address space. There should be no issue with returning SIZE_MAX, as for all intents and purposes, the virtual address space is practically unlimited.
Adding support for Job Objects in this way adds support for detecting memory limits when using native Windows Hyper-V containers, which uses Job Objects to limit memory.
- relates to
-
JDK-8364803 Provide support for Windows Job Objects that limit process resources
-
- Open
-
-
JDK-8365050 Too verbose warning in os::commit_memory_limit() on Windows
-
- Resolved
-
- links to
-
Commit(master) openjdk/jdk/8d529bc4
-
Review(master) openjdk/jdk/26593