擅长:python、mysql、java
<p><strong>第2部分的答案:<code>resource</code>模块文档提到了这种可能性:</p>
<blockquote>
<p><em>This module does not attempt to mask platform differences — symbols
not defined for a platform will not be available from this module on
that platform</em>.</p>
<p>According to the <code>bash</code> <code>ulimit</code> source linked to above, it uses
<code>RLIMIT_AS</code> if <code>RLIMIT_VMEM</code> is not defined.</p>
</blockquote>
<p>来源:<a href="https://stackoverflow.com/questions/30269238/limit-memory-usage-in-python/30269998#30269998">Limit memory usage?</a></p>