diff options
author | Maoni Stephens <Maoni0@users.noreply.github.com> | 2019-03-18 13:39:29 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-03-18 13:39:29 -0700 |
commit | cf887c943bf1dee978bc863b7481686ecee8ad83 (patch) | |
tree | bf48e8c1ca9a4494a7323510e1a285e835d047ec /src/pal/src/misc | |
parent | f2642ad1b4c94e21a92a5e6426f7a6556551977d (diff) | |
download | coreclr-cf887c943bf1dee978bc863b7481686ecee8ad83.tar.gz coreclr-cf887c943bf1dee978bc863b7481686ecee8ad83.tar.bz2 coreclr-cf887c943bf1dee978bc863b7481686ecee8ad83.zip |
Fix for running in a container without mem limit set on Windows; (#23297)
also fixing the LocalGC standalone case on Linux
Diffstat (limited to 'src/pal/src/misc')
-rw-r--r-- | src/pal/src/misc/cgroup.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/pal/src/misc/cgroup.cpp b/src/pal/src/misc/cgroup.cpp index 304b813f28..144ac669df 100644 --- a/src/pal/src/misc/cgroup.cpp +++ b/src/pal/src/misc/cgroup.cpp @@ -386,20 +386,18 @@ size_t PALAPI PAL_GetRestrictedPhysicalMemoryLimit() { - size_t physical_memory_limit; + size_t physical_memory_limit = 0; if (!CGroup::GetPhysicalMemoryLimit(&physical_memory_limit)) return 0; - else + + // If there's no memory limit specified on the container this + // actually returns 0x7FFFFFFFFFFFF000 (2^63-1 rounded down to + // 4k which is a common page size). So we know we are not + // running in a memory restricted environment. + if (physical_memory_limit > 0x7FFFFFFF00000000) { - // If there's no memory limit specified on the container this - // actually returns 0x7FFFFFFFFFFFF000 (2^63-1 rounded down to - // 4k which is a common page size). So we know we are not - // running in a memory restricted environment. - if (physical_memory_limit > 0x7FFFFFFF00000000) - { - return 0; - } + return 0; } struct rlimit curr_rlimit; |