<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 19, 2017 at 10:05 AM, Stephan Houben <span dir="ltr"><<a href="mailto:stephanh42@gmail.com" target="_blank">stephanh42@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Steve,<br><div><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">2017-10-19 1:59 GMT+02:00 Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_723493628466163041gmail-">On Wed, Oct 18, 2017 at 02:51:37PM +0200, Stefan Krah wrote:<br>
<br>
> $ softlimit -m 1000000000 python3<br>
</span>[...]<br>
<span class="gmail-m_723493628466163041gmail-">> MemoryError<br>
><br>
><br>
> People who are worried could make a python3 alias or use Ctrl-\.<br>
<br>
</span>I just tried that on two different Linux computers I have, and neither<br>
have softlimit.<br>
<br></blockquote><div><br></div></span><div>Yeah, not sure what "softlimit" is either.<br></div><div>I'd suggest sticking to POSIX-standard ulimit or just stick<br></div><div>something like this in the .pythonrc.py:<br><br>import resource<br>resource.setrlimit(resource.<wbr>RLIMIT_DATA, (2 * 1024**3, 2 * 1024**3))<br><br></div><span class="gmail-"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Nor (presumably) would this help Windows users.<br></blockquote><div><br></div></span><div>I (quickly) tried to get something to work using the win32 package,<br></div><div>in particular the win32job functions. <br>However, it seems setting<br></div><div>"ProcessMemoryLimit" using win32job.<wbr>SetInformationJobObject<br></div><div>had no effect <br>(i.e. a subsequent win32job.<wbr>QueryInformationJobObject<br></div><div>still showed the limit as 0)?<br><br></div><div>People with stronger Windows-fu may be aware what is going on here...<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></div><span class="gmail-HOEnZb"><font color="#888888"><div><br></div><div>Stephan </div></font></span></div></div></div></div></blockquote><div><br></div><div>I wasn't aware Windows was capable of setting such limits in a per-process fashion. You gave me a good idea for psutil:</div><div><a href="https://github.com/giampaolo/psutil/issues/1149">https://github.com/giampaolo/psutil/issues/1149</a><br></div></div><div class="gmail_extra">According to this cmdline tool:</div><div class="gmail_extra"><a href="https://cr.yp.to/daemontools/softlimit.html">https://cr.yp.to/daemontools/softlimit.html</a><br></div><div class="gmail_extra">....the limit should kick in only when the system memory is full, whatever that means:</div><div class="gmail_extra"><<-r n: Limit the resident set size to n bytes. This limit is not enforced unless physical memory is full.>></div><div class="gmail_extra">...so that would explain why it had no effect.</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Giampaolo - <a href="http://grodola.blogspot.com" target="_blank">http://grodola.blogspot.com</a></div><div><br></div></div></div>
</div></div>