如果内存只有1G,接下来又会发生什么,比如php,死机?
如果是node.js,单进程本来就有1G的内存限制。又会发生什么,崩溃?
<code class="language-js"><span class="nx">http</span><span class="p">.</span><span class="nx">createServer</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">{</span> <span class="kd">var</span> <span class="nx">fd</span> <span class="o">=</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">openSync</span><span class="p">(</span><span class="s1">'/tmp/'</span> <span class="o">+</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">(),</span> <span class="s1">'w+'</span><span class="p">);</span> <span class="nx">req</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">'data'</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">chunk</span><span class="p">)</span> <span class="p">{</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">writeSync</span><span class="p">(</span><span class="nx">fd</span><span class="p">,</span> <span class="nx">chunk</span><span class="p">);</span> <span class="p">});</span> <span class="nx">req</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">'end'</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="nx">callbackWithRequestBody</span><span class="p">(</span><span class="nx">fd</span><span class="p">);</span> <span class="nx">res</span><span class="p">.</span><span class="nx">end</span><span class="p">();</span> <span class="p">});</span> <span class="p">});</span> </code>