<p>I try to run an java application with this jvm option inside a docker orchestrated by k8s:</p>

<pre><code>-XX:InitialHeapSize=0 -XX:InitialRAMPercentage=0 -XX:MaxRAMPercentage=80
</code></pre>

<p>and this is my limits on cpu and on memory:</p>

<pre><code>resources:
          limits:
            cpu: 900m
            memory: 900M
          requests:
            cpu: 900m
            memory: 900M
</code></pre>

<p>when I apply for the changes, the application run even I give her a 0 for InitialRAMPercentage and 0 for XX:InitialHeapSize.</p>

<p>When I go inside my pod and I run <code>ps ax</code></p>

<p>It's give me this: </p>

<pre><code>PID TTY      STAT   TIME COMMAND
    1 ?        Ssl    0:53 java -XX:InitialHeapSize=0 -XX:InitialRAMPercentage=0 -XX:MaxRAMPercentage=80 
</code></pre>

<p>As I may understand, When I pass 0 as percentage, the application will not run because there is no memory are allowed. Is that true ? </p>

<p>Have you any explanation of it ?</p>

Hamdy
<p>The initial heap size just tells the JVM the starting heap size, it will grow it as necessary (until maximum heap size is reached). Also coincidentally, setting the initial size to 0 is the same as not setting it at all and lets the JVM judge the starting heap size by itself.</p>

<p>See for example <a href="https://stackoverflow.com/a/54297753/4929038">this</a> SO answer and the links provided in it.</p>
