Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news.szaf.org!news.gnuher.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: "Martin v. Loewis" Newsgroups: comp.lang.python Subject: Re: Sandboxed Python: memory limits? Date: Thu, 07 Apr 2011 10:01:39 +0200 Organization: 1&1 Internet AG Lines: 21 Message-ID: <4D9D6F63.9080004@v.loewis.de> References: NNTP-Posting-Host: port-92-206-213-187.dynamic.qsc.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: online.de 1302163299 9124 92.206.213.187 (7 Apr 2011 08:01:39 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Thu, 7 Apr 2011 08:01:39 +0000 (UTC) Cc: python-list@python.org To: Chris Angelico User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110307 Icedove/3.0.11 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2759 Am 07.04.2011 02:06, schrieb Chris Angelico: > On Thu, Apr 7, 2011 at 6:38 AM, Martin v. Loewis wrote: >> You can adjust the implementations of PyMem_Malloc and PyObject_Malloc. >> This would catch many allocations, but not all of them. If you adjust >> PyMem_MALLOC instead of PyMem_Malloc, you catch even more allocations - >> but extensions modules which directly call malloc() still would bypass >> this accounting. > > I'm not too concerned about extensions, here; in any case, I lock most > of them off. I just want to prevent stupid stuff like this: > > a='a' > while True: > a+=a That would certainly be caught by instrumenting PyObject_MALLOC. More generally, I believe that if you instrument the functions I mentioned, your use case is likely covered. Regards, Martin