mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8365050: Too verbose warning in os::commit_memory_limit() on Windows
Reviewed-by: dholmes, mbaesken
This commit is contained in:
parent
c31f4861fb
commit
f28126ebc2
@ -3297,13 +3297,28 @@ static char* map_or_reserve_memory_aligned(size_t size, size_t alignment, int fi
|
||||
}
|
||||
|
||||
size_t os::commit_memory_limit() {
|
||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = {};
|
||||
BOOL res = QueryInformationJobObject(nullptr, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli), nullptr);
|
||||
|
||||
BOOL is_in_job_object = false;
|
||||
BOOL res = IsProcessInJob(GetCurrentProcess(), nullptr, &is_in_job_object);
|
||||
if (!res) {
|
||||
char buf[512];
|
||||
size_t buf_len = os::lasterror(buf, sizeof(buf));
|
||||
warning("Attempt to query job object information failed: %s", buf_len != 0 ? buf : "<unknown error>");
|
||||
warning("Attempt to determine whether the process is running in a job failed for commit limit: %s", buf_len != 0 ? buf : "<unknown error>");
|
||||
|
||||
// Conservatively assume no limit when there was an error calling IsProcessInJob.
|
||||
return SIZE_MAX;
|
||||
}
|
||||
|
||||
if (!is_in_job_object) {
|
||||
// Not limited by a Job Object
|
||||
return SIZE_MAX;
|
||||
}
|
||||
|
||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = {};
|
||||
res = QueryInformationJobObject(nullptr, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli), nullptr);
|
||||
if (!res) {
|
||||
char buf[512];
|
||||
size_t buf_len = os::lasterror(buf, sizeof(buf));
|
||||
warning("Attempt to query job object information failed for commit limit: %s", buf_len != 0 ? buf : "<unknown error>");
|
||||
|
||||
// Conservatively assume no limit when there was an error calling QueryInformationJobObject.
|
||||
return SIZE_MAX;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user