[Python-Dev] pymalloc killer

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


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

> ...isn't this part just a little too complicated? If I understand
> correctly, arenas are 4K aligned pages. 

No, arenas are 256k areas which are split into 4k pools.

> Given an address, when you find its pool header, you either find a
> valid arena header that covers all 4K subsequent addresses, or some
> alien memory. I think you just have to look for the address of the
> pool header at the appropriate index in the vector. IOW, there
> should be no need to look at the address you're deallocating after
> finding its putative arena.

The pool in question and the arena it belongs to may have different
starting addresses (in 63 of 64 cases, they will be different).

Of course, you could also build the table for pool addresses,
assigning pool indices - but that would require 64 times as much
memory.

Regards,
Martin