Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3479 > unrolled thread

Re: An unusual question...

Started byChris Angelico <rosuav@gmail.com>
First post2011-04-18 19:57 +1000
Last post2011-04-18 19:57 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: An unusual question... Chris Angelico <rosuav@gmail.com> - 2011-04-18 19:57 +1000

#3479 — Re: An unusual question...

FromChris Angelico <rosuav@gmail.com>
Date2011-04-18 19:57 +1000
SubjectRe: An unusual question...
Message-ID<mailman.508.1303120623.9059.python-list@python.org>
On Mon, Apr 18, 2011 at 7:53 PM,  <wisecracker@tesco.net> wrote:
> Talking of nefarious usage...
>
> I wonder what this would do left unchecked on a current machine and current Python install...
>
> ###
>
> global somestring
> somestring = " "
>
> while 1:
>        #print somestring
>        somestring = somestring + " "
>
> ###

It'd take a while, but eventually bomb with MemoryError. If instead
you double the string's length with
"somestring=somestring+somestring", it'll bomb a lot quicker.

I know because I tried it. We have an isolation environment in which
we'll be allowing our clients to provide Python scripts - which means
we have to be sure it'll all be safe.

BTW, the point at which it bombs is defined by ulimit/rlimit, unless
you fiddle with the memory allocator. See previous thread on the
subject. :D

Chris Angelico

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web