<p>I am running a reactJs application in Production mode inside a Kubernetes pod.container runtime is docker.
Pod status is Running but  still we don't get UI. Also when I check logs I see the below JS stacktrace error.
To run React application I have given below command</p>
<blockquote>
<p>&quot;build&quot;: &quot;set max_old_space_size=8192 &amp;&amp; webpack --mode production --max_old_space_size=8192 &amp;&amp; serve -s dist -l 3000&quot;</p>
</blockquote>
<p>The error I see inside pod logs is</p>
<pre><code>FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
</code></pre>
<p>&lt;--- Last few GCs ---&gt;</p>
<pre><code>[114:0x5632d5a724a0]    27622 ms: Scavenge (reduce) 597.8 (600.3) -&gt; 597.3 (600.3) MB, 3.2 / 0.0 ms  (average mu = 0.185, current mu = 0.145) allocation failure
[114:0x5632d5a724a0]    27627 ms: Scavenge (reduce) 598.1 (600.3) -&gt; 597.5 (600.6) MB, 2.4 / 0.0 ms  (average mu = 0.185, current mu = 0.145) allocation failure
</code></pre>

niranjan pb
<p>The problem is that <code>--max_old_space_size</code> is MB and according to your question you are passing 8192 but your pod is limited in resources to 1024.</p>
<p>You need to do one of the following:</p>
<ol>
<li>Change your pod spec to reserve an amount more than 8192.</li>
<li>Change your command to set <code>--max_old_space_size</code> to a value under 1024.</li>
<li>Or change both, but you need to make sure your pod has enough memory</li>
</ol>
<p>What happens if you just remove both of the <code>max_old_space_size</code> altogether? Do you really need to override this?</p>
