[Python-Dev] valgrind

Tim Peters tim.peters at gmail.com
Tue Nov 7 08:20:14 CET 2006

[Herman Geza]
>> Here python reads from an already-freed memory area, right?

[Martin v. Löwis]
> It looks like it, yes. Of course, it could be a flaw in valgrind, too.
> To find out, one would have to understand what the memory block is,
> and what part of PyObject_Free accesses it.

When PyObject_Free is handed an address it doesn't control, the "arena
base address" it derives from that address may point at anything the
system malloc controls, including uninitialized memory, memory the
system malloc has allocated to something, memory the system malloc has
freed, or internal system malloc bookkeeping bytes.  The
Py_ADDRESS_IN_RANGE macro has no way to know before reading it up.

So figure out which line of code valgrind is complaining about
(doesn't valgrind usually produce that?).  If it's coming from the
expansion of Py_ADDRESS_IN_RANGE, it's not worth more thought.

More information about the Python-Dev mailing list