Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.04; 'extensions': 0.04; 'mentioned,': 0.05; 'covered.': 0.09; 'this:': 0.11; 'am,': 0.14; 'wrote:': 0.14; 'extensions,': 0.16; 'received:80.67': 0.16; 'received:80.67.31': 0.16; 'received:ispgateway.de': 0.16; 'subject:memory': 0.16; 'stuff': 0.18; 'modules': 0.20; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'thu,': 0.22; "i'm": 0.26; 'instead': 0.26; 'chris': 0.27; 'subject:?': 0.29; 'certainly': 0.29; 'cc:addr:python.org': 0.31; 'lock': 0.31; 'martin': 0.33; 'caught': 0.35; 'header:User- Agent:1': 0.35; 'too': 0.36; 'case,': 0.36; 'case': 0.37; 'apr': 0.38; 'but': 0.38; 'likely': 0.39; 'received:de': 0.39; 'would': 0.40; '2011': 0.62; 'believe': 0.66; 'schrieb': 0.84; 'stupid': 0.84; 'subject:limits': 0.84; 'instrument': 0.95 Date: Thu, 07 Apr 2011 10:01:39 +0200 From: "Martin v. Loewis" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110307 Icedove/3.0.11 MIME-Version: 1.0 Newsgroups: comp.lang.python To: Chris Angelico Subject: Re: Sandboxed Python: memory limits? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Df-Sender: martin@v.loewis.de Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 21 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1302163340 news.xs4all.nl 81485 [::ffff:82.94.164.166]:58660 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2760 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