[Python-Dev] Fw: Access violation when no memory

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Wed, 21 Jun 2000 01:34:31 +0200 (CEST)


Mark Hammond wrote:
> 
> >From the newsgroup.  Any thoughts?
> 
> Mark.
> 
> "Phil Mayes" <nospam@bitbucket.com> wrote in message
> news:<olD35.82$_%.4481@newsfeed.avtel.net>...
> > The following program progressively allocates all memory:
> >     size = 1 << 20
> >     list = [None,]
> >     while size:
> >         try:
> >             mem = [None] * size
> >             mem[0] = list
> >             list = mem
> >         except:
> >             size = size / 2
> >
> > It fails with an access violation.

The only immediate thought I have is that Python does not have builtin
emergency procedures for such extreme situations. Although there are some
safety checks, it is fairly easy to crash the interpreter in a number of
ways.

For example, with the introduction of the mmapmodule, there are even more
"risks", like managing to mmap the python executable and screw it up
completely (not speaking of the possibility to introduce Trojan horses
and similar if this is done on purpose). There would probably be more
checks, but complete safety is hard to achieve in the current state.

The proposed solution is not a solution. The example program dumps core
in different locations on my machine. We just do not have enough control
from Python for managing such extreme cases. Sad, but true...

-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252