[Python-Dev] CPython optimization: storing reference counters outside of objects

Sturla Molden sturla at molden.no
Tue May 24 14:25:59 CEST 2011

Den 24.05.2011 13:31, skrev Maciej Fijalkowski:
> Not sure what scenario exactly are you discussing here, but storing
> reference counts outside of objects has (at least on a single
> processor) worse cache locality than inside objects.

Artur Siekielski is not talking about cache locality, but copy-on-write 
fork on Linux et al.

When reference counts are updated after forking, memory pages marked 
copy-on-write are copied if they store reference counts. And then he 
quickly runs out of memory. He wants to put reference counts and 
PyObjects in different pages, so only the pages with reference counts 
get copied.

I don't think he cares about cache locality at all, but the rest of us 
do :-)


More information about the Python-Dev mailing list