<div dir="ltr">Hi,<div><br></div><div>On 23 May 2018 at 11:48, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><br></div></div>
There are some hints to how this could be done:<br>
<a href="https://github.com/dotnet/coreclr/blob/master/src/gc/unix/cgroup.cpp" rel="noreferrer" target="_blank">https://github.com/dotnet/<wbr>coreclr/blob/master/src/gc/<wbr>unix/cgroup.cpp</a><br>
<a href="https://stackoverflow.com/questions/42187085/check-mem-limit-within-a-docker-container" rel="noreferrer" target="_blank">https://stackoverflow.com/<wbr>questions/42187085/check-mem-<wbr>limit-within-a-docker-<wbr>container</a><br>
<br>
I just tried<br>
<br>
$ docker run --memory 512m --rm -it ubuntu bash<br>
<br>
root@0ae673d96789:/# cat /sys/fs/cgroup/memory/memory.<wbr>limit_in_bytes<br>
536870912<br>
<br>
Can you check in your docker container that<br>
cat /sys/fs/cgroup/memory/memory.<wbr>limit_in_bytes<br>
returns the maximum memory amount you specified ?<br></blockquote><div><br></div><div>Was just posting the same thing.</div><div><br></div><div>Yes, that approach works, and that's how the JVM does it now (<a href="https://bugs.openjdk.java.net/browse/JDK-8170888">https://bugs.openjdk.java.net/browse/JDK-8170888</a>), and others.</div><div><br></div><div>If there's no memory limit set you get (on 64-bit linux) 9223372036854771712, currently recommendation is to take the minimum of the total system memory (eg. /proc/meminfo) and the cgroups memory.limit_in_bytes</div><div> </div><div>Rob :)</div></div>
</div></div>