[issue9942] Allow memory sections to be OS MERGEABLE

Antoine Pitrou report at bugs.python.org
Sat Sep 25 12:34:45 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

> Answering the question as best I can: I don't know how the reference
> counter is implemented in CPython, but if it's just a field in a
> struct, then madvise could be sent the memory location starting with
> the byte immediately following the reference counter

Well, first, this would only work for large objects. Must objects in Python are quite small individually, unless you have very large (unicode or binary) strings, or very big integers.

Second, madvise() works at the page granularity (4096 bytes on most system), and it will be very likely this will include the reference count for the current object.

Third, MADV_MERGEABLE will only be efficient if you have actual duplications of whole memory pages (and, practically, if you have enough of them to make a real difference). Why do you think you might have such duplication in your workload?

----------
nosy: +pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9942>
_______________________________________


More information about the Python-bugs-list mailing list