Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2730
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.04; 'extensions': 0.04; 'memory.': 0.05; 'produces': 0.07; 'python': 0.07; '32-bit': 0.09; 'disable': 0.09; 'this:': 0.11; 'am,': 0.14; 'wrote:': 0.14; 'starts': 0.15; '*before*': 0.16; 'extensions,': 0.16; 'subject:memory': 0.16; "that'll": 0.16; 'stuff': 0.18; 'modules': 0.20; 'obviously': 0.20; 'variable': 0.21; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'thu,': 0.22; 'memory': 0.24; "i'm": 0.26; "i'll": 0.26; 'instead': 0.26; 'chris': 0.27; 'tried': 0.27; 'message-id:@mail.gmail.com': 0.28; 'subject:?': 0.29; 'exercise': 0.29; 'probably': 0.30; 'lock': 0.31; 'second': 0.31; 'to:addr:python-list': 0.32; 'martin': 0.33; 'skip:" 10': 0.34; 'actually': 0.34; 'disk': 0.35; 'too': 0.36; 'rather': 0.36; 'case,': 0.36; 'some': 0.37; 'received:209.85': 0.37; 'apr': 0.38; 'strings': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'happens': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'would': 0.40; "it's": 0.40; 'header:Received:5': 0.40; 'box,': 0.60; '2011': 0.62; 'boss': 0.68; 'physical': 0.74; '8gb': 0.84; 'difficult,': 0.84; 'dust': 0.84; 'node': 0.84; 'received:209.85.210.174': 0.84; 'received:mail- iy0-f174.google.com': 0.84; 'stupid': 0.84; 'subject:limits': 0.84; 'died': 0.97 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=GMMh7mNVFlzxiMvRpvLY7/uTnkZ7d2rZw61r99Zp6ko=; b=KMgrX7bsFOp7COQN1P+XngXXkQY4tg4vy9Ue20+cS2Veh7dFSlXWhUbetlfHJMzCcT Aj03UByYT0fptXwM47WCItMiQGk4G0qaFy9hStuM/R8dprSSGKyOKRmqxEDuURjoSHKI 4b/Og50HXTjxRVojDqC0R6hWurwgj8RS1qPxc= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=INiNn9HVwcVmwvy/ZuppHmNez/+01aTNAObOt7bhp4gRhd388tUofyDNGLvbQURaWT ozxyYo+OTZBlP9ajQit7gYOhIKcUCSWACYhcj+vR0xprgpjyp1UsqJht25bymFpKBycM 9HyUtOjDJJlU56n6LnMnry9vTW75XkAnVGXjg= |
| MIME-Version | 1.0 |
| In-Reply-To | <inij0j$v6v$1@online.de> |
| References | <mailman.62.1302055157.9059.python-list@python.org> <inij0j$v6v$1@online.de> |
| Date | Thu, 7 Apr 2011 10:06:15 +1000 |
| Subject | Re: Sandboxed Python: memory limits? |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.91.1302134778.9059.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1302134778 news.xs4all.nl 34849 [::ffff:82.94.164.166]:49424 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:2730 |
Show key headers only | View raw
On Thu, Apr 7, 2011 at 6:38 AM, Martin v. Loewis <martin@v.loewis.de> 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
from bringing the entire node to its knees. Obviously that will
eventually bomb with MemoryError, but I'd rather it be some time
*before* the poor computer starts thrashing virtual memory.
(Hmm. I tried the above code in Python 2.6.6 on my scratch box, with
3GB of memory, and it actually died with "OverflowError: strings are
too large to concat" at 1GB. Must be the 32-bit Python on there, heh.
But repeating the exercise in the same Python with a second variable
produces the expected MemoryError.)
If it's too difficult, I'll probably just tell my boss that we need
8GB of physical memory in these things, and then disable virtual
memory. That'll ensure that MemoryError happens before the hard disk
starts grinding performance into dust :)
Chris Angelico
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Sandboxed Python: memory limits? Chris Angelico <rosuav@gmail.com> - 2011-04-06 11:59 +1000
Re: Sandboxed Python: memory limits? "Martin v. Loewis" <martin@v.loewis.de> - 2011-04-06 22:38 +0200
Re: Sandboxed Python: memory limits? Chris Angelico <rosuav@gmail.com> - 2011-04-07 10:06 +1000
Re: Sandboxed Python: memory limits? "Martin v. Loewis" <martin@v.loewis.de> - 2011-04-07 10:01 +0200
Re: Sandboxed Python: memory limits? "Martin v. Loewis" <martin@v.loewis.de> - 2011-04-07 10:01 +0200
Re: Sandboxed Python: memory limits? Chris Angelico <rosuav@gmail.com> - 2011-04-07 10:10 +1000
Re: Sandboxed Python: memory limits? David Bolen <db3l.net@gmail.com> - 2011-04-07 14:36 -0400
Re: Sandboxed Python: memory limits? Chris Angelico <rosuav@gmail.com> - 2011-04-08 04:59 +1000
csiph-web