[Python-Dev] pymalloc killer

Martin v. Loewis martin@v.loewis.de
30 Mar 2002 00:56:42 +0100


"David Abrahams" <david.abrahams@rcn.com> writes:

> OK, but I guess my question still holds: can't you just round down to
> find a supposed arena address, look up the index, and see if that arena
> is in the vector?

Arenas are not aligned on 256k boundaries. Instead, they are aligned
on 8-byte boundaries (or whatever else the system malloc returns); the
first up-to-four-k is wasted to align the first pool in the arena.

So to find the arena header when given a pool header, you'd have to
know the index of the pool in the arena, which would be more
complicated than Tim's computation.

Regards,
Martin