[Python-Dev] int/float freelists vs pymalloc
Andrew MacIntyre
andymac at bullseye.apana.org.au
Fri Feb 8 23:56:24 CET 2008
Tim Peters wrote:
> pymalloc ensures 8-byte alignment. This is one plausible reason to
> keep the current int free list: an int object struct holds 3 4-byte
> members on most boxes (type pointer, refcount, and the int's value),
> and the int freelist code uses exactly 12 bytes for each on most
> boxes. To keep 8-byte alignment, pymalloc would have to hand out a
> 16-byte chunk per int object, wasting a fourth of the space (pymalloc
> always rounds up a requested size to a multiple of 8, and ensures the
> address returned is 8-byte aligned).
Hmmm... the funny thing is that the freelist approach is showing higher
memory consumption than the PyMalloc approach for the int case...
--
-------------------------------------------------------------------------
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au (pref) | Snail: PO Box 370
andymac at pcug.org.au (alt) | Belconnen ACT 2616
Web: http://www.andymac.org/ | Australia
More information about the Python-Dev
mailing list