[Python-Dev] Valgrind on 2.2.2
Tim Peters
tim.one@comcast.net
Mon, 28 Oct 2002 20:36:50 -0500
[Guido]
> ...
> (I wonder if pymalloc adds to the confusion, since its arenas count as
> a single block to malloc and hence to valgrind, but are internally cut
> up into many objects.)
For each arena, the address returned by malloc() is stored in the
file-static arenas[] vector. So if a diagnostic program can find that
vector, it can find the base address of every arena gotten from malloc.
In a debug build, though, pymalloc adds pad bytes to both ends of each
request (and whether handled by pymalloc or by malloc!), and returns the
address of the byte beyond the leading pad byte. This can leave any number
of system-malloc blocks with no direct pointer to their start. That's
specific to the debug build, which forces all Python mem API calls to go
thru pymalloc (the release build only directs PyObject_{Malloc,etc}() calls
to pymalloc).