A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-April/072682.html below:

[Python-Dev] FW: static analysis of python source

[Python-Dev] FW: static analysis of python source [Python-Dev] FW: static analysis of python sourceJosiah Carlson jcarlson at uci.edu
Fri Apr 20 17:59:55 CEST 2007
Kristján Valur Jónsson <kristjan at ccpgames.com> wrote:
> 
> I just ran some static analysis of the python core 2.5 with Visual Studio team system.
> There was the stray error discovered.  I will update the most obvious ones.
[snip]
> 2)  There is a lot of code that goes like this:
> f->buf = PyMem_Realloc(f->buf, newsize);
> if (!f->buf)
>     return PyErr_NoMemory(), 0;
> Now,  this if Realloc fails, this causes a memory leak.  Is there any
>  interest to fix this flawed pattern wholesale?

I believe the idea is that if you run into a MemoryError, in particular
on linux (whose allocator will give you a nonzero pointer well beyond
what was actually available), you can't really trust the state of the
interpreter, so it is expected that Python will be ending shortly. 
Forcing the leak (leaving the code as-is) basically encourages the
interpreter to have more and more errors before the expected, possibly
inevitable (and perhaps desireable) quitting of the Python interpreter.


 - Josiah

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4