[issue26601] Use new madvise()'s MADV_FREE on the private heap

Antti Haapala report at bugs.python.org
Fri Apr 22 07:35:10 EDT 2016


Antti Haapala added the comment:

mmap is not the problem, the eagerness of munmap is a source of possible problem. 

The munmap eagerness does not show problems in all programs because the arena allocation heuristics do not work as intended. A proper solution in Linux and other operating systems where it is supported, is to put the freed arenas in a list, then mark freed with MADV_FREE. Now if the memory pressure grows, only *then* will the OS reclaim these. At any time the application can start reusing these arenas/pages; if they're not reclaimed, the old contents will be still present there; if operating system reclaimed them, they'd be remapped with zeroes.

Really the only downside of all this that I can foresee is that `ps/top/whatever` output would see Python using way more memory in its RSS/virt/whatever than it is actually using.

----------

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


More information about the Python-bugs-list mailing list