Kristján Valur Jónsson <[EMAIL PROTECTED]> 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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com